663 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
664 #define _CRT_SECURE_NO_WARNINGS
668 #define IMGUI_DEFINE_MATH_OPERATORS
673 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
679 #define IMGUI_DEBUG_NAV_SCORING 0
680 #define IMGUI_DEBUG_NAV_RECTS 0
684 #pragma warning (disable: 4127) // condition expression is constant
685 #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
686 #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
691 #pragma clang diagnostic ignored "-Wunknown-pragmas" // warning : unknown warning group '-Wformat-pedantic *' // not all warnings are known by all clang versions.. so ignoring warnings triggers new warnings on some configuration. great!
692 #pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse.
693 #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok.
694 #pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.
695 #pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
696 #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
697 #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
698 #pragma clang diagnostic ignored "-Wformat-pedantic" // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic.
699 #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
700 #elif defined(__GNUC__)
701 #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
702 #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size
703 #pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*'
704 #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
705 #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
706 #pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked
707 #pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
712 #define IMGUI_CDECL __cdecl
717 static const ImS32 IM_S32_MIN = 0x80000000;
718 static const ImS32 IM_S32_MAX = 0x7FFFFFFF;
719 static const ImU32 IM_U32_MIN = 0;
720 static const ImU32 IM_U32_MAX = 0xFFFFFFFF;
721 static const ImS64 IM_S64_MIN = -9223372036854775807ll - 1ll;
722 static const ImS64 IM_S64_MAX = 9223372036854775807ll;
723 static const ImU64 IM_U64_MIN = 0;
724 static const ImU64 IM_U64_MAX = 0xFFFFFFFFFFFFFFFFull;
730 static bool IsKeyPressedMap(
ImGuiKey key,
bool repeat =
true);
732 static ImFont* GetDefaultFont();
734 static void SetWindowScrollX(
ImGuiWindow* window,
float new_scroll_x);
735 static void SetWindowScrollY(
ImGuiWindow* window,
float new_scroll_y);
741 static void CheckStacksSize(
ImGuiWindow* window,
bool write);
742 static ImVec2 CalcNextScrollFromScrollTargetAndClamp(
ImGuiWindow* window,
bool snap_on_edges);
750 static ImRect GetViewportRect();
752 static void ClosePopupToLevel(
int remaining);
755 static int InputTextCalcTextLenAndLineCount(
const char* text_begin,
const char** out_text_end);
756 static ImVec2 InputTextCalcTextSizeW(
const ImWchar* text_begin,
const ImWchar* text_end,
const ImWchar** remaining = NULL,
ImVec2* out_offset = NULL,
bool stop_on_new_line =
false);
758 static inline int DataTypeFormatString(
char*
buf,
int buf_size,
ImGuiDataType data_type,
const void* data_ptr,
const char*
format);
759 static void DataTypeApplyOp(
ImGuiDataType data_type,
int op,
void* output,
void* arg_1,
const void* arg_2);
760 static bool DataTypeApplyOpFromText(
const char*
buf,
const char* initial_value_buf,
ImGuiDataType data_type,
void* data_ptr,
const char*
format);
764 static void NavUpdate();
765 static void NavUpdateWindowing();
768 static void UpdateMovingWindow();
769 static void UpdateMouseInputs();
770 static void UpdateManualResize(
ImGuiWindow* window,
const ImVec2& size_auto_fit,
int* border_held,
int resize_grip_count,
ImU32 resize_grip_col[4]);
771 static void FocusFrontMostActiveWindow(
ImGuiWindow* ignore_window);
774 template<
typename TYPE,
typename SIGNEDTYPE,
typename FLOATTYPE>
775 static bool DragBehaviorT(
ImGuiDataType data_type, TYPE*
v,
float v_speed,
const TYPE v_min,
const TYPE v_max,
const char*
format,
float power);
777 template<
typename TYPE,
typename SIGNEDTYPE,
typename FLOATTYPE>
785 static const char* GetClipboardTextFn_DefaultImpl(
void* user_data);
786 static void SetClipboardTextFn_DefaultImpl(
void* user_data,
const char* text);
787 static void ImeSetInputScreenPosFn_DefaultImpl(
int x,
int y);
806 #ifndef IMGUI_DISABLE_DEFAULT_ALLOCATORS
807 static void* MallocWrapper(
size_t size,
void* user_data) { (
void)user_data;
return malloc(size); }
808 static void FreeWrapper(
void* ptr,
void* user_data) { (
void)user_data;
free(ptr); }
810 static void* MallocWrapper(
size_t size,
void* user_data) { (
void)user_data; (
void)size;
IM_ASSERT(0);
return NULL; }
811 static void FreeWrapper(
void* ptr,
void* user_data) { (
void)user_data; (
void)ptr;
IM_ASSERT(0); }
814 static void* (*GImAllocatorAllocFunc)(
size_t size,
void* user_data) = MallocWrapper;
815 static void (*GImAllocatorFreeFunc)(
void* ptr,
void* user_data) = FreeWrapper;
816 static void* GImAllocatorUserData = NULL;
817 static size_t GImAllocatorActiveAllocationsCount = 0;
887 memset(
this, 0,
sizeof(*
this));
927 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
957 ImWchar wchars[wchars_buf_len];
959 for (
int i = 0; i < wchars_buf_len && wchars[i] != 0; i++)
967 #define IM_STATIC_ASSERT(_COND) typedef char static_assertion_##__line__[(_COND)?1:-1]
968 #define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose
969 #define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255
975 float dot = ap.
x * ab_dir.
x + ap.
y * ab_dir.
y;
978 float ab_len_sqr = ab_dir.
x * ab_dir.
x + ab_dir.
y * ab_dir.
y;
979 if (dot > ab_len_sqr)
981 return a + ab_dir * dot / ab_len_sqr;
986 bool b1 = ((p.
x - b.
x) * (a.
y - b.
y) - (p.
y - b.
y) * (a.
x - b.
x)) < 0.0
f;
987 bool b2 = ((p.
x - c.
x) * (b.
y - c.
y) - (p.
y - c.
y) * (b.
x - c.
x)) < 0.0
f;
988 bool b3 = ((p.
x - a.
x) * (c.
y - a.
y) - (p.
y - a.
y) * (c.
x - a.
x)) < 0.0
f;
989 return ((b1 == b2) && (b2 == b3));
997 const float denom = v0.
x * v1.
y - v1.
x * v0.
y;
998 out_v = (v2.
x * v1.
y - v1.
x * v2.
y) / denom;
999 out_w = (v0.
x * v2.
y - v2.
x * v0.
y) / denom;
1000 out_u = 1.0f - out_v - out_w;
1008 float dist2_ab = ImLengthSqr(p - proj_ab);
1009 float dist2_bc = ImLengthSqr(p - proj_bc);
1010 float dist2_ca = ImLengthSqr(p - proj_ca);
1011 float m = ImMin(dist2_ab, ImMin(dist2_bc, dist2_ca));
1022 while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; }
1029 while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; }
1035 if (count < 1)
return;
1036 strncpy(dst, src, count);
1042 size_t len = strlen(str) + 1;
1044 return (
char*)memcpy(buf, (
const void*)str, len);
1049 for ( ; str < str_end; str++)
1064 while (buf_mid_line > buf_begin && buf_mid_line[-1] !=
'\n')
1066 return buf_mid_line;
1069 const char*
ImStristr(
const char* haystack,
const char* haystack_end,
const char* needle,
const char* needle_end)
1072 needle_end = needle + strlen(needle);
1074 const char un0 = (char)toupper(*needle);
1075 while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
1077 if (toupper(*haystack) == un0)
1079 const char*
b = needle + 1;
1080 for (
const char*
a = haystack + 1; b < needle_end;
a++, b++)
1081 if (toupper(*
a) != toupper(*b))
1083 if (b == needle_end)
1095 while (p[0] ==
' ' || p[0] ==
'\t')
1100 while (p > p_start && (p[-1] ==
' ' || p[-1] ==
'\t'))
1103 memmove(buf, p_start, p - p_start);
1104 buf[p - p_start] = 0;
1107 template<
typename TYPE>
1108 static const char* ImAtoi(
const char*
src, TYPE* output)
1111 if (*src ==
'-') { negative = 1; src++; }
1112 if (*src ==
'+') { src++; }
1114 while (*src >=
'0' && *src <=
'9')
1115 v = (v * 10) + (*src++ -
'0');
1116 *output = negative ? -v :
v;
1123 #ifndef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS
1127 va_start(args, fmt);
1128 int w = vsnprintf(buf, buf_size, fmt, args);
1132 if (w == -1 || w >= (
int)buf_size)
1133 w = (
int)buf_size - 1;
1140 int w = vsnprintf(buf, buf_size, fmt, args);
1143 if (w == -1 || w >= (
int)buf_size)
1144 w = (
int)buf_size - 1;
1148 #endif // #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS
1154 static ImU32 crc32_lut[256] = { 0 };
1157 const ImU32 polynomial = 0xEDB88320;
1158 for (
ImU32 i = 0; i < 256; i++)
1161 for (
ImU32 j = 0; j < 8; j++)
1162 crc = (crc >> 1) ^ (
ImU32(-
int(crc & 1)) & polynomial);
1169 const unsigned char* current = (
const unsigned char*)data;
1175 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];
1180 while (
unsigned char c = *current++)
1186 if (c ==
'#' && current[0] ==
'#' && current[1] ==
'#')
1188 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
1203 unsigned int c = (
unsigned int)-1;
1204 const unsigned char* str = (
const unsigned char*)in_text;
1207 c = (
unsigned int)(*str++);
1211 if ((*str & 0xe0) == 0xc0)
1214 if (in_text_end && in_text_end - (
const char*)str < 2)
return 1;
1215 if (*str < 0
xc2)
return 2;
1216 c = (
unsigned int)((*str++ & 0x1f) << 6);
1217 if ((*str & 0xc0) != 0x80)
return 2;
1218 c += (*str++ & 0x3f);
1222 if ((*str & 0xf0) == 0xe0)
1225 if (in_text_end && in_text_end - (
const char*)str < 3)
return 1;
1226 if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf))
return 3;
1227 if (*str == 0xed && str[1] > 0x9f)
return 3;
1228 c = (
unsigned int)((*str++ & 0x0f) << 12);
1229 if ((*str & 0xc0) != 0x80)
return 3;
1230 c += (
unsigned int)((*str++ & 0x3f) << 6);
1231 if ((*str & 0xc0) != 0x80)
return 3;
1232 c += (*str++ & 0x3f);
1236 if ((*str & 0xf8) == 0xf0)
1239 if (in_text_end && in_text_end - (
const char*)str < 4)
return 1;
1240 if (*str > 0xf4)
return 4;
1241 if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf))
return 4;
1242 if (*str == 0xf4 && str[1] > 0x8f)
return 4;
1243 c = (
unsigned int)((*str++ & 0x07) << 18);
1244 if ((*str & 0xc0) != 0x80)
return 4;
1245 c += (
unsigned int)((*str++ & 0x3f) << 12);
1246 if ((*str & 0xc0) != 0x80)
return 4;
1247 c += (
unsigned int)((*str++ & 0x3f) << 6);
1248 if ((*str & 0xc0) != 0x80)
return 4;
1249 c += (*str++ & 0x3f);
1251 if ((c & 0xFFFFF800) == 0xD800)
return 4;
1262 ImWchar* buf_end = buf + buf_size;
1263 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1273 if (in_text_remaining)
1274 *in_text_remaining = in_text;
1275 return (
int)(buf_out -
buf);
1281 while ((!in_text_end || in_text < in_text_end) && *in_text)
1294 static inline int ImTextCharToUtf8(
char*
buf,
int buf_size,
unsigned int c)
1303 if (buf_size < 2)
return 0;
1304 buf[0] = (char)(0xc0 + (c >> 6));
1305 buf[1] = (char)(0x80 + (c & 0x3f));
1308 if (c >= 0xdc00 && c < 0xe000)
1312 if (c >= 0xd800 && c < 0xdc00)
1314 if (buf_size < 4)
return 0;
1315 buf[0] = (char)(0xf0 + (c >> 18));
1316 buf[1] = (char)(0x80 + ((c >> 12) & 0x3f));
1317 buf[2] = (char)(0x80 + ((c >> 6) & 0x3f));
1318 buf[3] = (char)(0x80 + ((c ) & 0x3f));
1323 if (buf_size < 3)
return 0;
1324 buf[0] = (char)(0xe0 + (c >> 12));
1325 buf[1] = (char)(0x80 + ((c>> 6) & 0x3f));
1326 buf[2] = (char)(0x80 + ((c ) & 0x3f));
1331 static inline int ImTextCountUtf8BytesFromChar(
unsigned int c)
1333 if (c < 0x80)
return 1;
1334 if (c < 0x800)
return 2;
1335 if (c >= 0xdc00 && c < 0xe000)
return 0;
1336 if (c >= 0xd800 && c < 0xdc00)
return 4;
1342 char* buf_out =
buf;
1343 const char* buf_end = buf + buf_size;
1344 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1346 unsigned int c = (
unsigned int)(*in_text++);
1348 *buf_out++ = (char)c;
1350 buf_out += ImTextCharToUtf8(buf_out, (
int)(buf_end-buf_out-1), c);
1353 return (
int)(buf_out -
buf);
1358 int bytes_count = 0;
1359 while ((!in_text_end || in_text < in_text_end) && *in_text)
1361 unsigned int c = (
unsigned int)(*in_text++);
1365 bytes_count += ImTextCountUtf8BytesFromChar(c);
1372 float s = 1.0f/255.0f;
1394 c.
w *= style.
Alpha * alpha_mul;
1409 return style.
Colors[idx];
1415 if (style_alpha >= 1.0
f)
1418 a = (
ImU32)(a * style_alpha);
1438 const float chroma = r - (g < b ? g :
b);
1439 out_h = ImFabs(K + (g - b) / (6.
f * chroma + 1e-20
f));
1440 out_s = chroma / (r + 1e-20
f);
1451 out_r = out_g = out_b =
v;
1455 h = ImFmod(h, 1.0
f) / (60.0f/360.0f);
1458 float p = v * (1.0f - s);
1459 float q = v * (1.0f - s *
f);
1460 float t = v * (1.0f - s * (1.0f -
f));
1464 case 0: out_r =
v; out_g = t; out_b = p;
break;
1465 case 1: out_r = q; out_g =
v; out_b = p;
break;
1466 case 2: out_r = p; out_g =
v; out_b = t;
break;
1467 case 3: out_r = p; out_g = q; out_b =
v;
break;
1468 case 4: out_r = t; out_g = p; out_b =
v;
break;
1469 case 5:
default: out_r =
v; out_g = p; out_b = q;
break;
1475 #if defined(_WIN32) && !defined(__CYGWIN__)
1480 buf.
resize(filename_wsize + mode_wsize);
1483 return _wfopen((
wchar_t*)&buf[0], (
wchar_t*)&buf[filename_wsize]);
1485 return fopen(filename, mode);
1491 void*
ImFileLoadToMemory(
const char* filename,
const char* file_open_mode,
size_t* out_file_size,
int padding_bytes)
1498 if ((f =
ImFileOpen(filename, file_open_mode)) == NULL)
1501 long file_size_signed;
1502 if (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET))
1508 size_t file_size = (
size_t)file_size_signed;
1510 if (file_data == NULL)
1515 if (fread(file_data, 1, file_size, f) != file_size)
1521 if (padding_bytes > 0)
1522 memset((
void *)(((
char*)file_data) + file_size), 0, (
size_t)padding_bytes);
1526 *out_file_size = file_size;
1544 size_t count2 = count >> 1;
1549 count -= count2 + 1;
1564 static int IMGUI_CDECL PairCompareByID(
const void* lhs,
const void* rhs)
1567 if (((
const Pair*)lhs)->key > ((
const Pair*)rhs)->key)
return +1;
1568 if (((
const Pair*)lhs)->key < ((
const Pair*)rhs)->key)
return -1;
1573 qsort(
Data.Data, (
size_t)
Data.Size,
sizeof(
Pair), StaticFunc::PairCompareByID);
1579 if (it ==
Data.end() || it->key != key)
1586 return GetInt(key, default_val ? 1 : 0) != 0;
1592 if (it ==
Data.end() || it->key != key)
1600 if (it ==
Data.end() || it->key != key)
1609 if (it ==
Data.end() || it->key != key)
1610 it =
Data.insert(it,
Pair(key, default_val));
1616 return (
bool*)
GetIntRef(key, default_val ? 1 : 0);
1622 if (it ==
Data.end() || it->key != key)
1623 it =
Data.insert(it,
Pair(key, default_val));
1630 if (it ==
Data.end() || it->key != key)
1631 it =
Data.insert(it,
Pair(key, default_val));
1639 if (it ==
Data.end() || it->key != key)
1649 SetInt(key, val ? 1 : 0);
1655 if (it ==
Data.end() || it->key != key)
1666 if (it ==
Data.end() || it->key != key)
1676 for (
int i = 0; i <
Data.Size; i++)
1708 return value_changed;
1715 const char* we = wb;
1718 if (*we == separator)
1736 for (
int i = 0; i !=
Filters.Size; i++)
1741 if (
Filters[i].front() !=
'-')
1754 for (
int i = 0; i !=
Filters.Size; i++)
1759 if (f.
front() ==
'-')
1787 #define va_copy(dest, src) (dest = src)
1803 const int write_off = Buf.Size;
1804 const int needed_sz = write_off +
len;
1805 if (write_off + len >= Buf.Capacity)
1807 int double_capacity = Buf.Capacity * 2;
1808 Buf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity);
1811 Buf.resize(needed_sz);
1812 ImFormatStringV(&Buf[write_off - 1], (
size_t)len + 1, fmt, args_copy);
1819 va_start(args, fmt);
1820 appendfv(fmt, args);
1831 Spacing = Width = NextWidth = 0.0f;
1832 memset(Pos, 0,
sizeof(Pos));
1833 memset(NextWidths, 0,
sizeof(NextWidths));
1840 Width = NextWidth = 0.0f;
1842 if (clear) memset(NextWidths, 0,
sizeof(NextWidths));
1843 for (
int i = 0; i < Count; i++)
1845 if (i > 0 && NextWidths[i] > 0.0
f)
1847 Pos[i] = (
float)(
int)Width;
1848 Width += NextWidths[i];
1849 NextWidths[i] = 0.0f;
1856 NextWidths[0] = ImMax(NextWidths[0], w0);
1857 NextWidths[1] = ImMax(NextWidths[1], w1);
1858 NextWidths[2] = ImMax(NextWidths[2], w2);
1859 for (
int i = 0; i < 3; i++)
1860 NextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0
f) ?
Spacing : 0.0
f);
1861 return ImMax(Width, NextWidth);
1866 return ImMax(0.0
f, avail_w - Width);
1873 static void SetCursorPosYAndSetupDummyPrevLine(
float pos_y,
float line_height)
1892 ItemsHeight = items_height;
1895 DisplayEnd = DisplayStart = -1;
1896 if (ItemsHeight > 0.0
f)
1899 if (DisplayStart > 0)
1900 SetCursorPosYAndSetupDummyPrevLine(StartPosY + DisplayStart * ItemsHeight, ItemsHeight);
1910 if (ItemsCount < INT_MAX)
1911 SetCursorPosYAndSetupDummyPrevLine(StartPosY + ItemsCount * ItemsHeight, ItemsHeight);
1933 if (ItemsCount == 1) { ItemsCount = -1;
return false; }
1936 Begin(ItemsCount-1, items_height);
1944 IM_ASSERT(DisplayStart >= 0 && DisplayEnd >= 0);
1958 : DrawListInst(&context->DrawListSharedData)
2028 ImGuiID id =
ImHash(str, str_end ? (
int)(str_end - str) : 0, seed);
2044 return ImHash(str, str_end ? (
int)(str_end - str) : 0, seed);
2069 static void SetNavID(
ImGuiID id,
int nav_layer)
2073 IM_ASSERT(nav_layer == 0 || nav_layer == 1);
2078 static void SetNavIDWithRectRel(
ImGuiID id,
int nav_layer,
const ImRect& rect_rel)
2081 SetNavID(
id, nav_layer);
2166 if (focused_root_window->WasActive && focused_root_window != window->
RootWindow)
2211 static ImGuiDir inline NavScoreItemGetQuadrant(
float dx,
float dy)
2213 if (ImFabs(dx) > ImFabs(dy))
2218 static float inline NavScoreItemDistInterval(
float a0,
float a1,
float b0,
float b1)
2227 static void inline NavClampRectToVisibleAreaForMoveDir(
ImGuiDir move_dir,
ImRect&
r,
const ImRect& clip_rect)
2258 float dbx = NavScoreItemDistInterval(cand.
Min.
x, cand.
Max.
x, curr.
Min.
x, curr.
Max.
x);
2259 float dby = NavScoreItemDistInterval(ImLerp(cand.
Min.
y, cand.
Max.
y, 0.2f), ImLerp(cand.
Min.
y, cand.
Max.
y, 0.8f), ImLerp(curr.
Min.
y, curr.
Max.
y, 0.2f), ImLerp(curr.
Min.
y, curr.
Max.
y, 0.8f));
2260 if (dby != 0.0
f && dbx != 0.0
f)
2261 dbx = (dbx/1000.0f) + ((dbx > 0.0
f) ? +1.0f : -1.0f);
2262 float dist_box = ImFabs(dbx) + ImFabs(dby);
2267 float dist_center = ImFabs(dcx) + ImFabs(dcy);
2271 float dax = 0.0f, day = 0.0f, dist_axial = 0.0f;
2272 if (dbx != 0.0
f || dby != 0.0
f)
2277 dist_axial = dist_box;
2278 quadrant = NavScoreItemGetQuadrant(dbx, dby);
2280 else if (dcx != 0.0
f || dcy != 0.0
f)
2285 dist_axial = dist_center;
2286 quadrant = NavScoreItemGetQuadrant(dcx, dcy);
2294 #if IMGUI_DEBUG_NAV_SCORING
2298 ImFormatString(buf,
IM_ARRAYSIZE(buf),
"dbox (%.2f,%.2f->%.4f)\ndcen (%.2f,%.2f->%.4f)\nd (%.2f,%.2f->%.4f)\nnav %c, quadrant %c", dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial,
"WENS"[g.
NavMoveDir],
"WENS"[quadrant]);
2319 bool new_best =
false;
2323 if (dist_box < result->DistBox)
2329 if (dist_box == result->
DistBox)
2332 if (dist_center < result->DistCenter)
2353 if (result->
DistBox == FLT_MAX && dist_axial < result->DistAxial)
2364 static void NavSaveLastChildNavWindow(
ImGuiWindow* child_window)
2369 if (parent_window && parent_window != child_window)
2379 static void NavRestoreLayer(
int layer)
2391 static inline void NavUpdateAnyRequestFlag()
2399 static bool NavMoveRequestButNoResultYet()
2409 NavUpdateAnyRequestFlag();
2429 if (!(item_flags & ImGuiItemFlags_NoNavDefaultFocus))
2432 NavUpdateAnyRequestFlag();
2445 bool new_best = NavScoreItem(result, nav_bb) && g.
NavMoveRequest;
2447 bool new_best = g.
NavMoveRequest && NavScoreItem(result, nav_bb);
2488 NavProcessItem(window, nav_bb_arg ? *nav_bb_arg : bb,
id);
2496 const bool is_clipped =
IsClippedEx(bb,
id,
false);
2536 if (!IsWindowContentHoverable(window, flags))
2589 if (allow_keyboard_focus)
2618 if (size.
x < 0.0f || size.
y < 0.0f)
2629 if (wrap_pos_x < 0.0
f)
2633 if (wrap_pos_x == 0.0
f)
2635 else if (wrap_pos_x > 0.0
f)
2638 return ImMax(wrap_pos_x - pos.
x, 1.0f);
2645 GImAllocatorActiveAllocationsCount++;
2646 return GImAllocatorAllocFunc(size, GImAllocatorUserData);
2651 if (ptr) GImAllocatorActiveAllocationsCount--;
2652 return GImAllocatorFreeFunc(ptr, GImAllocatorUserData);
2680 #ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC
2681 IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx);
2693 if (sz_io !=
sizeof(
ImGuiIO)) { error =
true;
IM_ASSERT(sz_io ==
sizeof(
ImGuiIO) &&
"Mismatched struct layout!"); }
2695 if (sz_vec2 !=
sizeof(
ImVec2)) { error =
true;
IM_ASSERT(sz_vec2 ==
sizeof(
ImVec2) &&
"Mismatched struct layout!"); }
2696 if (sz_vec4 !=
sizeof(
ImVec4)) { error =
true;
IM_ASSERT(sz_vec4 ==
sizeof(
ImVec4) &&
"Mismatched struct layout!"); }
2703 GImAllocatorAllocFunc = alloc_func;
2704 GImAllocatorFreeFunc = free_func;
2705 GImAllocatorUserData = user_data;
2729 IM_ASSERT(GImGui != NULL &&
"No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
2735 IM_ASSERT(GImGui != NULL &&
"No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
2736 return GImGui->
Style;
2748 return GImGui->
Time;
2771 bool init_for_nav =
false;
2774 init_for_nav =
true;
2782 NavUpdateAnyRequestFlag();
2790 static ImVec2 NavCalcPreferredRefPos()
2799 ImRect visible_rect = GetViewportRect();
2800 return ImFloor(ImClamp(pos, visible_rect.
Min, visible_rect.
Max));
2812 static ImGuiWindow* FindWindowNavigable(
int i_start,
int i_stop,
int dir)
2815 for (
int i = i_start; i >= 0 && i < g.
Windows.
Size && i != i_stop; i += dir)
2833 return (t == 0.0
f) ? 1.0f : 0.0f;
2870 delta *= slow_factor;
2872 delta *= fast_factor;
2876 static void NavUpdateWindowingHighlightWindow(
int focus_change_dir)
2884 ImGuiWindow* window_target = FindWindowNavigable(i_current + focus_change_dir, -INT_MAX, focus_change_dir);
2886 window_target = FindWindowNavigable((focus_change_dir < 0) ? (g.
Windows.
Size - 1) : 0, i_current, focus_change_dir);
2892 static void ImGui::NavUpdateWindowing()
2896 bool apply_toggle_layer =
false;
2900 if (start_windowing_with_gamepad || start_windowing_with_keyboard)
2918 if (focus_change_dir != 0)
2920 NavUpdateWindowingHighlightWindow(focus_change_dir);
2929 apply_toggle_layer =
true;
2942 NavUpdateWindowingHighlightWindow(g.
IO.
KeyShift ? +1 : -1);
2951 apply_toggle_layer =
true;
2961 if (move_delta.
x != 0.0f || move_delta.
y != 0.0f)
2963 const float NAV_MOVE_SPEED = 800.0f;
2976 apply_focus_window = NavRestoreLastChildNavWindow(apply_focus_window);
2986 if (apply_focus_window)
3008 static void NavScrollToBringItemIntoView(
ImGuiWindow* window,
ImRect& item_rect_rel)
3013 if (window_rect_rel.Contains(item_rect_rel))
3017 if (window->
ScrollbarX && item_rect_rel.
Min.
x < window_rect_rel.Min.x)
3022 else if (window->
ScrollbarX && item_rect_rel.
Max.
x >= window_rect_rel.Max.x)
3027 if (item_rect_rel.
Min.
y < window_rect_rel.Min.y)
3032 else if (item_rect_rel.
Max.
y >= window_rect_rel.Max.y)
3039 ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window,
false);
3043 static void ImGui::NavUpdate()
3059 #define NAV_MAP_KEY(_KEY, _NAV_INPUT) if (IsKeyDown(g.IO.KeyMap[_KEY])) { g.IO.NavInputs[_NAV_INPUT] = 1.0f; g.NavInputSource = ImGuiInputSource_NavKeyboard; }
3106 NavScrollToBringItemIntoView(result->
Window, result->
RectRel);
3147 NavUpdateWindowing();
3169 SetNavID(child_window->
ChildId, 0);
3200 if (g.
ActiveId == 0 && activate_pressed)
3255 NavUpdateAnyRequestFlag();
3276 SetWindowScrollX(window, ImFloor(window->
Scroll.
x + scroll_dir.
x * scroll_speed));
3279 if (scroll_dir.
y != 0.0f)
3281 SetWindowScrollY(window, ImFloor(window->
Scroll.
y + scroll_dir.
y * scroll_speed));
3298 window_rect_rel.Expand(
ImVec2(-ImMin(window_rect_rel.GetWidth(), pad), -ImMin(window_rect_rel.GetHeight(), pad)));
3313 #if IMGUI_DEBUG_NAV_RECTS
3315 if (g.
NavWindow) {
ImU32 col = (g.
NavWindow->
HiddenFrames == 0) ?
IM_COL32(255,0,255,255) :
IM_COL32(255,0,0,255);
ImVec2 p = NavCalcPreferredRefPos();
char buf[32];
ImFormatString(buf, 32,
"%d", g.
NavLayer); g.
OverlayDrawList.
AddCircleFilled(p, 3.0
f, col); g.
OverlayDrawList.
AddText(NULL, 13.0
f, p +
ImVec2(8,-4), col, buf); }
3319 static void ImGui::UpdateMovingWindow()
3332 if (moving_window->
Pos.
x != pos.
x || moving_window->
Pos.
y != pos.
y)
3357 static void ImGui::UpdateMouseInputs()
3428 int mouse_earliest_button_down = -1;
3429 bool mouse_any_down =
false;
3437 mouse_earliest_button_down = i;
3439 const bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.
IO.
MouseDownOwned[mouse_earliest_button_down];
3444 if (!mouse_avail_to_imgui && !mouse_dragging_extern_payload)
3467 IM_ASSERT(GImGui != NULL &&
"No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
3473 IM_ASSERT(g.
IO.
DeltaTime >= 0.0f &&
"Need a positive DeltaTime (zero is tolerated but will cause some timing issues)");
3475 IM_ASSERT(g.
IO.
Fonts->
Fonts.
Size > 0 &&
"Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
3476 IM_ASSERT(g.
IO.
Fonts->
Fonts[0]->IsLoaded() &&
"Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
3478 IM_ASSERT(g.
Style.
Alpha >= 0.0f && g.
Style.
Alpha <= 1.0f &&
"Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)");
3564 UpdateMouseInputs();
3573 UpdateMovingWindow();
3606 window->
Size *= scale;
3609 else if (!g.
IO.
KeyCtrl && scroll_allowed)
3612 float scroll_amount = 5 * scroll_window->
CalcFontSize();
3614 SetWindowScrollY(scroll_window, scroll_window->
Scroll.
y - g.
IO.
MouseWheel * scroll_amount);
3647 FocusFrontMostActiveWindow(NULL);
3658 Begin(
"Debug##Default");
3665 settings = AddWindowSettings(name);
3666 return (
void*)settings;
3674 if (sscanf(line,
"Pos=%f,%f", &x, &y) == 2) settings->
Pos =
ImVec2(x, y);
3676 else if (sscanf(line,
"Collapsed=%d", &i) == 1) settings->
Collapsed = (i != 0);
3690 settings = AddWindowSettings(window->
Name);
3691 settings->
Pos = window->
Pos;
3702 if (settings->
Pos.
x == FLT_MAX)
3704 const char* name = settings->
Name;
3705 if (
const char* p = strstr(name,
"###"))
3708 buf->
appendf(
"Pos=%d,%d\n", (
int)settings->
Pos.
x, (
int)settings->
Pos.
y);
3724 ini_handler.
ReadOpenFn = SettingsHandlerWindow_ReadOpen;
3725 ini_handler.
ReadLineFn = SettingsHandlerWindow_ReadLine;
3726 ini_handler.
WriteAllFn = SettingsHandlerWindow_WriteAll;
3810 size_t file_data_size = 0;
3838 ini_size = strlen(ini_data);
3840 char* buf_end = buf + ini_size;
3841 memcpy(buf, ini_data, ini_size);
3844 void* entry_data = NULL;
3847 char* line_end = NULL;
3848 for (
char* line = buf; line < buf_end; line = line_end + 1)
3851 while (*line ==
'\n' || *line ==
'\r')
3854 while (line_end < buf_end && *line_end !=
'\n' && *line_end !=
'\r')
3858 if (line[0] ==
'[' && line_end > line && line_end[-1] ==
']')
3862 const char* name_end = line_end - 1;
3863 const char* type_start = line + 1;
3864 char* type_end = (
char*)(intptr_t)
ImStrchrRange(type_start, name_end,
']');
3865 const char* name_start = type_end ?
ImStrchrRange(type_end + 1, name_end,
'[') : NULL;
3866 if (!type_end || !name_start)
3868 name_start = type_start;
3869 type_start =
"Window";
3877 entry_data = entry_handler ? entry_handler->
ReadOpenFn(&g, entry_handler, name_start) : NULL;
3879 else if (entry_handler != NULL && entry_data != NULL)
3882 entry_handler->
ReadLineFn(&g, entry_handler, entry_data, line);
3896 size_t ini_data_size = 0;
3901 fwrite(ini_data,
sizeof(
char), ini_data_size, f);
3938 static int IMGUI_CDECL ChildWindowComparer(
const void* lhs,
const void* rhs)
3957 for (
int i = 0; i <
count; i++)
3961 AddWindowToSortedBuffer(out_sorted_windows, child);
3994 IM_ASSERT(draw_list->
_VtxCurrentIdx < (1 << 16) &&
"Too many vertices in ImDrawList using 16-bit indices. Read comment above");
4001 AddDrawListToDrawData(out_render_list, window->
DrawList);
4006 AddWindowToDrawData(out_render_list, child);
4010 static void AddWindowToDrawDataSelectLayer(
ImGuiWindow* window)
4040 out_draw_data->
Valid =
true;
4041 out_draw_data->
CmdLists = (draw_lists->
Size > 0) ? draw_lists->
Data : NULL;
4055 window->
DrawList->
PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
4118 bool hovered_window_above_modal =
false;
4120 hovered_window_above_modal =
true;
4121 for (
int i = g.
Windows.
Size - 1; i >= 0 && hovered_window_above_modal ==
false; i--)
4124 if (window == modal)
4127 hovered_window_above_modal =
true;
4174 AddWindowToDrawDataSelectLayer(window);
4176 if (window_to_render_front_most && window_to_render_front_most->
Active && window_to_render_front_most->
HiddenFrames == 0)
4177 AddWindowToDrawDataSelectLayer(window_to_render_front_most);
4188 g.
OverlayDrawList.
AddImage(tex_id, pos +
ImVec2(1,0)*sc, pos+
ImVec2(1,0)*sc + size*sc, uv[2], uv[3],
IM_COL32(0,0,0,48));
4189 g.
OverlayDrawList.
AddImage(tex_id, pos +
ImVec2(2,0)*sc, pos+
ImVec2(2,0)*sc + size*sc, uv[2], uv[3],
IM_COL32(0,0,0,48));
4203 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
4211 const char* text_display_end = text;
4213 text_end = (
const char*)-1;
4215 while (text_display_end < text_end && *text_display_end !=
'\0' && (text_display_end[0] !=
'#' || text_display_end[1] !=
'#'))
4217 return text_display_end;
4228 va_start(args, fmt);
4230 vfprintf(g.
LogFile, fmt, args);
4238 static void LogRenderedText(
const ImVec2* ref_pos,
const char* text,
const char* text_end = NULL)
4246 const bool log_new_line = ref_pos && (ref_pos->
y > window->
DC.
LogLinePosY + 1);
4250 const char* text_remaining = text;
4257 const char* line_end = text_remaining;
4258 while (line_end < text_end)
4259 if (*line_end ==
'\n')
4263 if (line_end >= text_end)
4266 const bool is_first_line = (text == text_remaining);
4267 bool is_last_line =
false;
4268 if (line_end == NULL)
4270 is_last_line =
true;
4271 line_end = text_end;
4273 if (line_end != NULL && !(is_last_line && (line_end - text_remaining)==0))
4275 const int char_count = (
int)(line_end - text_remaining);
4276 if (log_new_line || !is_first_line)
4284 text_remaining = line_end + 1;
4296 const char* text_display_end;
4297 if (hide_text_after_hash)
4304 text_end = text + strlen(text);
4305 text_display_end = text_end;
4308 if (text != text_display_end)
4312 LogRenderedText(&pos, text, text_display_end);
4322 text_end = text + strlen(text);
4324 if (text != text_end)
4328 LogRenderedText(&pos, text, text_end);
4338 const int text_len = (
int)(text_display_end - text);
4347 const ImVec2 text_size = text_size_if_known ? *text_size_if_known :
CalcTextSize(text, text_display_end,
false, 0.0
f);
4349 const ImVec2* clip_min = clip_rect ? &clip_rect->
Min : &pos_min;
4350 const ImVec2* clip_max = clip_rect ? &clip_rect->
Max : &pos_max;
4351 bool need_clipping = (pos.
x + text_size.
x >= clip_max->
x) || (pos.
y + text_size.
y >= clip_max->
y);
4353 need_clipping |= (pos.
x < clip_min->
x) || (pos.
y < clip_min->
y);
4356 if (align.
x > 0.0f) pos.
x = ImMax(pos.
x, pos.
x + (pos_max.
x - pos.
x - text_size.
x) * align.
x);
4357 if (align.
y > 0.0f) pos.
y = ImMax(pos.
y, pos.
y + (pos_max.
y - pos.
y - text_size.
y) * align.
y);
4362 ImVec4 fine_clip_rect(clip_min->
x, clip_min->
y, clip_max->
x, clip_max->
y);
4370 LogRenderedText(&pos, text, text_display_end);
4380 if (border && border_size > 0.0
f)
4392 if (border_size > 0.0
f)
4406 float r = h * 0.40f * scale;
4407 ImVec2 center = p_min +
ImVec2(h * 0.50
f, h * 0.50f * scale);
4415 center.
y -= r * 0.25f;
4416 a = ImVec2(0,1) *
r;
4417 b = ImVec2(-0.866f,-0.5f) *
r;
4418 c = ImVec2(+0.866f,-0.5f) *
r;
4423 center.
x -= r * 0.25f;
4424 a = ImVec2(1,0) *
r;
4425 b = ImVec2(-0.500f,+0.866f) *
r;
4426 c = ImVec2(-0.500f,-0.866f) *
r;
4449 float thickness = ImMax(sz / 5.0
f, 1.0
f);
4450 sz -= thickness*0.5f;
4451 pos +=
ImVec2(thickness*0.25
f, thickness*0.25f);
4453 float third = sz / 3.0f;
4454 float bx = pos.
x + third;
4455 float by = pos.
y + sz - third*0.5f;
4474 ImRect display_rect = bb;
4478 const float THICKNESS = 2.0f;
4479 const float DISTANCE = 3.0f + THICKNESS * 0.5f;
4480 display_rect.Expand(
ImVec2(DISTANCE,DISTANCE));
4500 const char* text_display_end;
4501 if (hide_text_after_double_hash)
4504 text_display_end = text_end;
4507 const float font_size = g.
FontSize;
4508 if (text == text_display_end)
4509 return ImVec2(0.0
f, font_size);
4510 ImVec2 text_size = font->
CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);
4513 const float font_scale = font_size / font->
FontSize;
4514 const float character_spacing_x = 1.0f * font_scale;
4515 if (text_size.
x > 0.0f)
4516 text_size.
x -= character_spacing_x;
4517 text_size.
x = (
float)(
int)(text_size.
x + 0.95f);
4532 *out_items_display_start = 0;
4533 *out_items_display_end = items_count;
4538 *out_items_display_start = *out_items_display_end = 0;
4550 start = ImClamp(start, 0, items_count);
4551 end = ImClamp(end + 1, start, items_count);
4552 *out_items_display_start =
start;
4553 *out_items_display_end =
end;
4585 ImRect rect_clipped(r_min, r_max);
4594 static bool IsKeyPressedMap(
ImGuiKey key,
bool repeat)
4596 const int key_index = GImGui->
IO.
KeyMap[key];
4603 return GImGui->
IO.
KeyMap[imgui_key];
4609 if (user_key_index < 0)
return false;
4618 if (t <= repeat_delay || repeat_rate <= 0.0
f)
4620 const int count = (
int)((t - repeat_delay) / repeat_rate) - (
int)((t_prev - repeat_delay) / repeat_rate);
4621 return (count > 0) ? count : 0;
4627 if (key_index < 0)
return false;
4636 if (user_key_index < 0)
return false;
4649 if (user_key_index < 0)
return false;
4681 if ((ImFmod(t - delay, rate) > rate*0.5
f) != (ImFmod(t - delay - g.
IO.
DeltaTime, rate) > rate*0.5f))
4708 if (lock_threshold < 0.0
f)
4730 if (mouse_pos == NULL)
4732 const float MOUSE_INVALID = -256000.0f;
4733 return mouse_pos->
x >= MOUSE_INVALID && mouse_pos->
y >= MOUSE_INVALID;
4741 if (lock_threshold < 0.0
f)
4851 static ImRect GetViewportRect()
4863 char window_name[16];
4865 if (override_previous_tooltip)
4874 Begin(window_name, NULL, flags | extra_flags);
4887 va_start(args, fmt);
4973 bool has_focus =
false;
4981 ClosePopupToLevel(n);
4994 static void ClosePopupToLevel(
int remaining)
5000 focus_window = NavRestoreLastChildNavWindow(focus_window);
5023 ClosePopupToLevel(popup_idx);
5088 if (!is_open || (p_open && !*p_open))
5099 static void NavProcessMoveRequestWrapAround(
ImGuiWindow* window)
5102 if (g.
NavWindow == window && NavMoveRequestButNoResultYet())
5152 str_id =
"window_context";
5163 str_id =
"void_context";
5179 const int auto_fit_axises = ((size.
x == 0.0f) ? (1 <<
ImGuiAxis_X) : 0x00) | ((size.
y == 0.0f) ? (1 <<
ImGuiAxis_Y) : 0x00);
5181 size.
x = ImMax(content_avail.
x + size.
x, 4.0f);
5183 size.
y = ImMax(content_avail.
y + size.
y, 4.0f);
5188 flags |= extra_flags;
5218 return BeginChildEx(str_id, window->
GetID(str_id), size_arg,
border, extra_flags);
5224 return BeginChildEx(NULL,
id, size_arg, border, extra_flags);
5241 sz.
x = ImMax(4.0
f, sz.
x);
5243 sz.
y = ImMax(4.0
f, sz.
y);
5286 static void CheckStacksSize(
ImGuiWindow* window,
bool write)
5291 {
int current = window->
IDStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushID/PopID or TreeNode/TreePop Mismatch!"); p_backup++; }
5292 {
int current = window->
DC.
GroupStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginGroup/EndGroup Mismatch!"); p_backup++; }
5293 {
int current = g.
CurrentPopupStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++;}
5295 {
int current = g.
ColorModifiers.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup >= current &&
"PushStyleColor/PopStyleColor Mismatch!"); p_backup++; }
5296 {
int current = g.
StyleModifiers.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup >= current &&
"PushStyleVar/PopStyleVar Mismatch!"); p_backup++; }
5297 {
int current = g.
FontStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup >= current &&
"PushFont/PopFont Mismatch!"); p_backup++; }
5310 ImRect r_screen = GetViewportRect();
5319 ImVec2 base_pos_clamped = ImClamp(ref_pos, r_outer.
Min, r_outer.
Max - size);
5329 const ImGuiDir dir = (
n == -1) ? *last_dir : dir_prefered_order[
n];
5330 if (
n != -1 && dir == *last_dir)
5348 const ImGuiDir dir = (
n == -1) ? *last_dir : dir_prefered_order[
n];
5349 if (
n != -1 && dir == *last_dir)
5353 if (avail_w < size.
x || avail_h < size.
y)
5365 pos.
x = ImMax(ImMin(pos.
x + size.
x, r_outer.
Max.
x) - size.
x, r_outer.
Min.
x);
5366 pos.
y = ImMax(ImMin(pos.
y + size.
y, r_outer.
Max.
y) - size.
y, r_outer.
Min.
y);
5374 ImRect r_outer = FindAllowedExtentRectForWindow(window);
5386 r_avoid =
ImRect(parent_window->
Pos.
x + horizontal_overlap, -FLT_MAX, parent_window->
Pos.
x + parent_window->
Size.
x - horizontal_overlap - parent_window->
ScrollbarSizes.
x, FLT_MAX);
5398 ImVec2 ref_pos = NavCalcPreferredRefPos();
5401 r_avoid =
ImRect(ref_pos.
x - 16, ref_pos.
y - 8, ref_pos.
x + 16, ref_pos.
y + 8);
5403 r_avoid =
ImRect(ref_pos.
x - 16, ref_pos.
y - 8, ref_pos.
x + 24 * sc, ref_pos.
y + 24 * sc);
5406 pos = ref_pos +
ImVec2(2, 2);
5446 window->
Pos = ImFloor(settings->
Pos);
5448 if (ImLengthSqr(settings->
Size) > 0.00001f)
5449 size = ImFloor(settings->
Size);
5461 if (window->
Size.
x <= 0.0f)
5463 if (window->
Size.
y <= 0.0f)
5520 return size_contents;
5526 ImVec2 size_auto_fit_after_constraint = CalcSizeAfterConstraint(window, size_auto_fit);
5531 return size_auto_fit;
5545 static ImVec2 CalcNextScrollFromScrollTargetAndClamp(
ImGuiWindow* window,
bool snap_on_edges)
5559 if (snap_on_edges && cr_y <= 0.0
f && target_y <= window->WindowPadding.y)
5565 scroll = ImMax(scroll,
ImVec2(0.0
f, 0.0
f));
5585 ImVec2 pos_min = ImLerp(corner_target, window->
Pos, corner_norm);
5586 ImVec2 pos_max = ImLerp(window->
Pos + window->
Size, corner_target, corner_norm);
5587 ImVec2 size_expected = pos_max - pos_min;
5588 ImVec2 size_constrained = CalcSizeAfterConstraint(window, size_expected);
5590 if (corner_norm.
x == 0.0f)
5591 out_pos->
x -= (size_constrained.
x - size_expected.
x);
5592 if (corner_norm.
y == 0.0f)
5593 out_pos->
y -= (size_constrained.
y - size_expected.
y);
5594 *out_size = size_constrained;
5612 static ImRect GetBorderRect(
ImGuiWindow* window,
int border_n,
float perp_padding,
float thickness)
5615 if (thickness == 0.0
f) rect.
Max -=
ImVec2(1,1);
5616 if (border_n == 0)
return ImRect(rect.
Min.
x + perp_padding, rect.
Min.
y, rect.
Max.
x - perp_padding, rect.
Min.
y + thickness);
5617 if (border_n == 1)
return ImRect(rect.
Max.
x - thickness, rect.
Min.
y + perp_padding, rect.
Max.
x, rect.
Max.
y - perp_padding);
5618 if (border_n == 2)
return ImRect(rect.
Min.
x + perp_padding, rect.
Max.
y - thickness, rect.
Max.
x - perp_padding, rect.
Max.
y);
5619 if (border_n == 3)
return ImRect(rect.
Min.
x, rect.
Min.
y + perp_padding, rect.
Min.
x + thickness, rect.
Max.
y - perp_padding);
5625 static void ImGui::UpdateManualResize(
ImGuiWindow* window,
const ImVec2& size_auto_fit,
int* border_held,
int resize_grip_count,
ImU32 resize_grip_col[4])
5634 const float grip_hover_size = (
float)(
int)(grip_draw_size * 0.75f);
5636 ImVec2 pos_target(FLT_MAX, FLT_MAX);
5637 ImVec2 size_target(FLT_MAX, FLT_MAX);
5641 for (
int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
5647 ImRect resize_rect(corner, corner + grip.
InnerDir * grip_hover_size);
5648 if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x);
5649 if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y);
5652 if (hovered || held)
5658 size_target = CalcSizeAfterConstraint(window, size_auto_fit);
5666 CalcResizePosSizeFromAnyCorner(window, corner_target, grip.
CornerPos, &pos_target, &size_target);
5668 if (resize_grip_n == 0 || held || hovered)
5671 for (
int border_n = 0; border_n < resize_border_count; border_n++)
5673 const float BORDER_SIZE = 5.0f;
5674 const float BORDER_APPEAR_TIMER = 0.05f;
5676 ImRect border_rect = GetBorderRect(window, border_n, grip_hover_size, BORDER_SIZE);
5681 if (held) *border_held = border_n;
5691 CalcResizePosSizeFromAnyCorner(window, border_target, border_posn, &pos_target, &size_target);
5704 if (nav_resize_delta.
x != 0.0f || nav_resize_delta.
y != 0.0f)
5706 const float NAV_RESIZE_SPEED = 600.0f;
5712 size_target = CalcSizeAfterConstraint(window, window->
SizeFull + nav_resize_delta);
5717 if (size_target.x != FLT_MAX)
5722 if (pos_target.x != FLT_MAX)
5724 window->
Pos = ImFloor(pos_target);
5748 const bool window_just_created = (window == NULL);
5749 if (window_just_created)
5752 window = CreateNewWindow(name, size_on_first_use, flags);
5759 if (flags & ImGuiWindowFlags_NavFlattened)
5763 const bool first_begin_of_the_frame = (window->
LastFrameActive != current_frame);
5764 if (first_begin_of_the_frame)
5767 flags = window->
Flags;
5770 bool window_just_activated_by_user = (window->
LastFrameActive < current_frame - 1);
5771 const bool window_just_appearing_after_hidden_for_resize = (window->
HiddenFrames > 0);
5775 window_just_activated_by_user |= (window->
PopupId != popup_ref.
PopupId);
5776 window_just_activated_by_user |= (window != popup_ref.
Window);
5778 window->
Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize);
5786 IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
5790 SetCurrentWindow(window);
5791 CheckStacksSize(window,
true);
5792 if (flags & ImGuiWindowFlags_Popup)
5795 popup_ref.
Window = window;
5800 if (window_just_appearing_after_hidden_for_resize && !(flags & ImGuiWindowFlags_ChildWindow))
5804 bool window_pos_set_by_api =
false;
5805 bool window_size_x_set_by_api =
false, window_size_y_set_by_api =
false;
5835 else if (first_begin_of_the_frame)
5847 if (first_begin_of_the_frame)
5854 if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !window_is_child_tooltip)
5877 if (window_just_created && (!window_size_x_set_by_api || !window_size_y_set_by_api))
5882 if (window_just_activated_by_user && (flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0)
5885 if (flags & ImGuiWindowFlags_AlwaysAutoResize)
5887 if (!window_size_x_set_by_api)
5889 if (!window_size_y_set_by_api)
5895 SetCurrentWindow(window);
5927 ImVec2 size_full_modified(FLT_MAX, FLT_MAX);
5928 if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->
Collapsed)
5931 if (!window_size_x_set_by_api)
5932 window->
SizeFull.
x = size_full_modified.
x = size_auto_fit.
x;
5933 if (!window_size_y_set_by_api)
5934 window->
SizeFull.
y = size_full_modified.
y = size_auto_fit.
y;
5970 if (window_just_activated_by_user)
5973 if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api)
5978 if (flags & ImGuiWindowFlags_ChildWindow)
5982 if (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !window_is_child_tooltip)
5987 if (window_pos_with_pivot)
5990 window->
Pos = FindBestWindowPosForPopup(window);
5991 else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)
5992 window->
Pos = FindBestWindowPosForPopup(window);
5993 else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)
5994 window->
Pos = FindBestWindowPosForPopup(window);
5997 if (!(flags & ImGuiWindowFlags_ChildWindow))
6002 window->
Pos = ImMax(window->
Pos + window->
Size, padding) - window->
Size;
6006 window->
Pos = ImFloor(window->
Pos);
6018 window->
Scroll = CalcNextScrollFromScrollTargetAndClamp(window,
true);
6022 bool want_focus =
false;
6024 if (!(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
6028 int border_held = -1;
6029 ImU32 resize_grip_col[4] = { 0 };
6033 UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
6036 if (window->
Size.
x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
6047 ImRect viewport_rect(GetViewportRect());
6048 if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)
6077 RenderFrame(title_bar_rect.
Min, title_bar_rect.
Max, title_bar_col,
true, window_rounding);
6093 if (!(flags & ImGuiWindowFlags_NoTitleBar))
6097 if (flags & ImGuiWindowFlags_MenuBar)
6113 if (!(flags & ImGuiWindowFlags_NoResize))
6115 for (
int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
6127 if (window_border_size > 0.0
f)
6129 if (border_held != -1)
6131 ImRect border = GetBorderRect(window, border_held, grip_draw_size, 0.0
f);
6134 if (style.
FrameBorderSize > 0 && !(flags & ImGuiWindowFlags_NoTitleBar))
6214 if (!(flags & ImGuiWindowFlags_NoTitleBar))
6223 if (!(flags & ImGuiWindowFlags_NoCollapse))
6238 const float rad = g.
FontSize * 0.5f;
6249 ImRect text_r = title_bar_rect;
6254 text_r.
Min.
x += pad_left;
6255 text_r.
Max.
x -= pad_right;
6256 ImRect clip_rect = text_r;
6299 if (first_begin_of_the_frame)
6307 if (flags & ImGuiWindowFlags_ChildWindow)
6320 if (style.
Alpha <= 0.0f)
6329 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
6333 if (size_first_use.
x != 0.0f || size_first_use.
y != 0.0f)
6337 if (bg_alpha_override >= 0.0
f)
6342 #endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS
6361 CheckStacksSize(window,
false);
6377 const ImGuiID id = window->
GetID(horizontal ?
"#SCROLLX" :
"#SCROLLY");
6381 float other_scrollbar_size_w = other_scrollbar ? style.
ScrollbarSize : 0.0f;
6386 : ImRect(window_rect.
Max.
x - style.
ScrollbarSize, window->
Pos.
y + border_size, window_rect.
Max.
x - border_size, window_rect.
Max.
y - other_scrollbar_size_w - border_size);
6392 int window_rounding_corners;
6398 bb.
Expand(
ImVec2(-ImClamp((
float)(
int)((bb.
Max.
x - bb.
Min.
x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((
float)(
int)((bb.
Max.
y - bb.
Min.
y - 2.0f) * 0.5f), 0.0f, 3.0f)));
6402 float scroll_v = horizontal ? window->
Scroll.
x : window->
Scroll.
y;
6403 float win_size_avail_v = (horizontal ? window->
SizeFull.
x : window->
SizeFull.
y) - other_scrollbar_size_w;
6408 IM_ASSERT(ImMax(win_size_contents_v, win_size_avail_v) > 0.0
f);
6409 const float win_size_v = ImMax(ImMax(win_size_contents_v, win_size_avail_v), 1.0
f);
6410 const float grab_h_pixels = ImClamp(scrollbar_size_v * (win_size_avail_v / win_size_v), style.
GrabMinSize, scrollbar_size_v);
6411 const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
6415 bool hovered =
false;
6416 const bool previously_held = (g.
ActiveId ==
id);
6419 float scroll_max = ImMax(1.0
f, win_size_contents_v - win_size_avail_v);
6420 float scroll_ratio = ImSaturate(scroll_v / scroll_max);
6421 float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
6422 if (held && grab_h_norm < 1.0
f)
6424 float scrollbar_pos_v = horizontal ? bb.
Min.
x : bb.
Min.
y;
6429 const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
6432 bool seek_absolute =
false;
6433 if (!previously_held)
6436 if (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm)
6438 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
6442 seek_absolute =
true;
6443 *click_delta_to_grab_center_v = 0.0f;
6449 const float scroll_v_norm = ImSaturate((clicked_v_norm - *click_delta_to_grab_center_v - grab_h_norm*0.5
f) / (1.0f - grab_h_norm));
6450 scroll_v = (
float)(
int)(0.5f + scroll_v_norm * scroll_max);
6457 scroll_ratio = ImSaturate(scroll_v / scroll_max);
6458 grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
6462 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
6469 grab_rect = ImRect(ImLerp(bb.
Min.
x, bb.
Max.
x, grab_v_norm), bb.
Min.
y, ImMin(ImLerp(bb.
Min.
x, bb.
Max.
x, grab_v_norm) + grab_h_pixels, window_rect.
Max.
x), bb.
Max.
y);
6471 grab_rect = ImRect(bb.
Min.
x, ImLerp(bb.
Min.
y, bb.
Max.
y, grab_v_norm), bb.
Max.
x, ImMin(ImLerp(bb.
Min.
y, bb.
Max.
y, grab_v_norm) + grab_h_pixels, window_rect.
Max.
y));
6479 if (current_front_window == window || current_front_window->
RootWindow == window)
6535 if (!(window->
Flags & ImGuiWindowFlags_NoBringToFrontOnFocus))
6539 void ImGui::FocusFrontMostActiveWindow(
ImGuiWindow* ignore_window)
6564 const float w_item_one = ImMax(1.0
f, (
float)(
int)((w_full - (style.
ItemInnerSpacing.
x) * (components-1)) / (
float)components));
6565 const float w_item_last = ImMax(1.0
f, (
float)(
int)(w_full - (w_item_one + style.
ItemInnerSpacing.
x) * (components-1)));
6567 for (
int i = 0; i < components-1; i++)
6587 w = ImMax(1.0
f, width_to_right_edge + w);
6593 static ImFont* GetDefaultFont()
6618 font = GetDefaultFont();
6753 return &GStyleVarInfo[idx];
6856 while (window != NULL)
6858 if (window == potential_parent)
6937 return window->
Size.
x;
6943 return window->
Size.
y;
6953 static void SetWindowScrollX(
ImGuiWindow* window,
float new_scroll_x)
6956 window->
Scroll.
x = new_scroll_x;
6960 static void SetWindowScrollY(
ImGuiWindow* window,
float new_scroll_y)
6963 window->
Scroll.
y = new_scroll_y;
6973 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond));
6979 window->
Pos = ImFloor(pos);
6999 return window->
Size;
7008 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond));
7100 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond));
7109 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond));
7133 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond));
7223 return GImGui->
Font;
7342 IM_ASSERT(center_y_ratio >= 0.0
f && center_y_ratio <= 1.0
f);
7381 NavUpdateAnyRequestFlag();
7413 va_start(args, fmt);
7428 va_start(args, fmt);
7443 va_start(args, fmt);
7459 va_start(args, fmt);
7472 const char* text_begin = text;
7473 if (text_end == NULL)
7474 text_end = text + strlen(text);
7478 const bool wrap_enabled = wrap_pos_x >= 0.0f;
7479 if (text_end - text > 2000 && !wrap_enabled)
7485 const char* line = text;
7490 if (text_pos.
y <= clip_rect.
Max.
y)
7497 int lines_skippable = (
int)((clip_rect.
Min.
y - text_pos.
y) / line_height);
7498 if (lines_skippable > 0)
7500 int lines_skipped = 0;
7501 while (line < text_end && lines_skipped < lines_skippable)
7503 const char* line_end = strchr(line,
'\n');
7505 line_end = text_end;
7506 line = line_end + 1;
7509 pos.
y += lines_skipped * line_height;
7514 if (line < text_end)
7516 ImRect line_rect(pos, pos +
ImVec2(FLT_MAX, line_height));
7517 while (line < text_end)
7519 const char* line_end = strchr(line,
'\n');
7524 text_size.
x = ImMax(text_size.
x, line_size.
x);
7527 line_end = text_end;
7528 line = line_end + 1;
7529 line_rect.
Min.
y += line_height;
7530 line_rect.
Max.
y += line_height;
7531 pos.
y += line_height;
7535 int lines_skipped = 0;
7536 while (line < text_end)
7538 const char* line_end = strchr(line,
'\n');
7540 line_end = text_end;
7541 line = line_end + 1;
7544 pos.
y += lines_skipped * line_height;
7547 text_size.
y += (pos - text_pos).y;
7550 ImRect bb(text_pos, text_pos + text_size);
7560 ImRect bb(text_pos, text_pos + text_size);
7600 const char* value_text_begin = &g.
TempBuffer[0];
7603 if (label_size.
x > 0.0f)
7610 va_start(args, fmt);
7622 if (out_hovered) *out_hovered =
false;
7623 if (out_held) *out_held =
false;
7636 bool pressed =
false;
7652 if ((flags & ImGuiButtonFlags_FlattenChildren) && g.
HoveredRootWindow == window)
7712 if (nav_activated_by_code || nav_activated_by_inputs)
7714 if (nav_activated_by_code || nav_activated_by_inputs || g.
ActiveId ==
id)
7754 if (out_hovered) *out_hovered = hovered;
7755 if (out_held) *out_held = held;
7776 const ImRect bb(pos, pos + size);
7801 return ButtonEx(label, size_arg, 0);
7871 bool is_clipped = !
ItemAdd(bb,
id);
7883 float cross_extent = (radius * 0.7071f) - 1.0
f;
7886 window->
DrawList->
AddLine(center +
ImVec2(+cross_extent,+cross_extent), center +
ImVec2(-cross_extent,-cross_extent), cross_col, 1.0
f);
7887 window->
DrawList->
AddLine(center +
ImVec2(+cross_extent,-cross_extent), center +
ImVec2(-cross_extent,+cross_extent), cross_col, 1.0
f);
7899 if (border_col.
w > 0.0f)
7905 if (border_col.
w > 0.0f)
7931 PushID((
void *)user_texture_id);
7949 if (bg_col.
w > 0.0f)
8047 const bool log_to_clipboard =
Button(
"Log To Clipboard");
SameLine();
8060 if (log_to_clipboard)
8080 storage->
SetInt(
id, is_open);
8085 const int stored_value = storage->
GetInt(
id, -1);
8086 if (stored_value == -1)
8089 storage->
SetInt(
id, is_open);
8093 is_open = stored_value != 0;
8137 const float text_offset_x = (g.
FontSize + (display_frame ? padding.
x*3 : padding.
x*2));
8138 const float text_width = g.
FontSize + (label_size.
x > 0.0f ? label_size.
x + padding.
x*2 : 0.0f);
8152 bool item_add =
ItemAdd(interact_bb,
id);
8158 if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
8174 bool hovered, held, pressed =
ButtonBehavior(interact_bb,
id, &hovered, &held, button_flags);
8175 if (!(flags & ImGuiTreeNodeFlags_Leaf))
8177 bool toggled =
false;
8183 if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
8211 const ImVec2 text_pos = frame_bb.
Min +
ImVec2(text_offset_x, text_base_offset_y);
8221 const char log_prefix[] =
"\n##";
8222 const char log_suffix[] =
"##";
8223 LogRenderedText(&text_pos, log_prefix, log_prefix+3);
8225 LogRenderedText(&text_pos, log_suffix+1, log_suffix+3);
8243 else if (!(flags & ImGuiTreeNodeFlags_Leaf))
8246 LogRenderedText(&text_pos,
">");
8247 RenderText(text_pos, label, label_end,
false);
8250 if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
8272 if (p_open && !*p_open)
8281 float button_sz = g.
FontSize * 0.5f;
8335 va_start(args, fmt);
8336 bool is_open =
TreeNodeExV(str_id, flags, fmt, args);
8344 va_start(args, fmt);
8345 bool is_open =
TreeNodeExV(ptr_id, flags, fmt, args);
8353 va_start(args, fmt);
8362 va_start(args, fmt);
8418 const void* ptr_id = (
void*)(intptr_t)int_id;
8494 va_start(args, fmt);
8499 static inline int DataTypeFormatString(
char* buf,
int buf_size,
ImGuiDataType data_type,
const void* data_ptr,
const char*
format)
8506 return ImFormatString(buf, buf_size, format, *(
const float*)data_ptr);
8508 return ImFormatString(buf, buf_size, format, *(
const double*)data_ptr);
8514 static void DataTypeApplyOp(
ImGuiDataType data_type,
int op,
void* output,
void* arg1,
const void* arg2)
8520 if (op ==
'+') *(
int*)output = *(
const int*)arg1 + *(
const int*)arg2;
8521 else if (op ==
'-') *(
int*)output = *(
const int*)arg1 - *(
const int*)arg2;
8524 if (op ==
'+') *(
unsigned int*)output = *(
const unsigned int*)arg1 + *(
const ImU32*)arg2;
8525 else if (op ==
'-') *(
unsigned int*)output = *(
const unsigned int*)arg1 - *(
const ImU32*)arg2;
8528 if (op ==
'+') *(
ImS64*)output = *(
const ImS64*)arg1 + *(
const ImS64*)arg2;
8529 else if (op ==
'-') *(
ImS64*)output = *(
const ImS64*)arg1 - *(
const ImS64*)arg2;
8532 if (op ==
'+') *(
ImU64*)output = *(
const ImU64*)arg1 + *(
const ImU64*)arg2;
8533 else if (op ==
'-') *(
ImU64*)output = *(
const ImU64*)arg1 - *(
const ImU64*)arg2;
8536 if (op ==
'+') *(
float*)output = *(
const float*)arg1 + *(
const float*)arg2;
8537 else if (op ==
'-') *(
float*)output = *(
const float*)arg1 - *(
const float*)arg2;
8540 if (op ==
'+') *(
double*)output = *(
const double*)arg1 + *(
const double*)arg2;
8541 else if (op ==
'-') *(
double*)output = *(
const double*)arg1 - *(
const double*)arg2;
8557 {
sizeof(
int),
"%d",
"%d" },
8558 {
sizeof(
unsigned int),
"%u",
"%u" },
8560 {
sizeof(
ImS64),
"%I64d",
"%I64d" },
8561 {
sizeof(
ImU64),
"%I64u",
"%I64u" },
8563 {
sizeof(
ImS64),
"%lld",
"%lld" },
8564 {
sizeof(
ImU64),
"%llu",
"%llu" },
8566 {
sizeof(
float),
"%f",
"%f" },
8567 {
sizeof(double),
"%f",
"%lf" },
8573 static bool DataTypeApplyOpFromText(
const char* buf,
const char* initial_value_buf,
ImGuiDataType data_type,
void* data_ptr,
const char* format)
8575 while (ImCharIsBlankA(*buf))
8581 if (op ==
'+' || op ==
'*' || op ==
'/')
8584 while (ImCharIsBlankA(*buf))
8597 IM_ASSERT(GDataTypeInfo[data_type].Size <=
sizeof(data_backup));
8598 memcpy(data_backup, data_ptr, GDataTypeInfo[data_type].Size);
8601 format = GDataTypeInfo[data_type].
ScanFmt;
8606 int* v = (
int*)data_ptr;
8609 if (op && sscanf(initial_value_buf, format, &arg0i) < 1)
8612 if (op ==
'+') {
if (sscanf(buf,
"%d", &arg1i)) *v = (
int)(arg0i + arg1i); }
8613 else if (op ==
'*') {
if (sscanf(buf,
"%f", &arg1f)) *v = (
int)(arg0i * arg1f); }
8614 else if (op ==
'/') {
if (sscanf(buf,
"%f", &arg1f) && arg1f != 0.0f) *v = (
int)(arg0i / arg1f); }
8615 else {
if (sscanf(buf, format, &arg1i) == 1) *v = arg1i; }
8621 sscanf(buf, format, data_ptr);
8627 float* v = (
float*)data_ptr;
8628 float arg0f = *
v, arg1f = 0.0f;
8629 if (op && sscanf(initial_value_buf, format, &arg0f) < 1)
8631 if (sscanf(buf, format, &arg1f) < 1)
8633 if (op ==
'+') { *v = arg0f + arg1f; }
8634 else if (op ==
'*') { *v = arg0f * arg1f; }
8635 else if (op ==
'/') {
if (arg1f != 0.0
f) *v = arg0f / arg1f; }
8636 else { *v = arg1f; }
8641 double* v = (
double*)data_ptr;
8642 double arg0f = *
v, arg1f = 0.0;
8643 if (op && sscanf(initial_value_buf, format, &arg0f) < 1)
8645 if (sscanf(buf, format, &arg1f) < 1)
8647 if (op ==
'+') { *v = arg0f + arg1f; }
8648 else if (op ==
'*') { *v = arg0f * arg1f; }
8649 else if (op ==
'/') {
if (arg1f != 0.0
f) *v = arg0f / arg1f; }
8650 else { *v = arg1f; }
8652 return memcmp(data_backup, data_ptr, GDataTypeInfo[data_type].Size) != 0;
8672 DataTypeFormatString(data_buf,
IM_ARRAYSIZE(data_buf), data_type, data_ptr, format);
8690 while (
char c = fmt[0])
8692 if (c ==
'%' && fmt[1] !=
'%')
8706 const unsigned int ignored_uppercase_mask = (1 << (
'I'-
'A')) | (1 << (
'L'-
'A'));
8707 const unsigned int ignored_lowercase_mask = (1 << (
'h'-
'a')) | (1 << (
'j'-
'a')) | (1 << (
'l'-
'a')) | (1 << (
't'-
'a')) | (1 << (
'w'-
'a')) | (1 << (
'z'-
'a'));
8708 for (
char c; (c = *fmt) != 0; fmt++)
8710 if (c >=
'A' && c <=
'Z' && ((1 << (c -
'A')) & ignored_uppercase_mask) == 0)
8712 if (c >=
'a' && c <=
'z' && ((1 << (c -
'a')) & ignored_lowercase_mask) == 0)
8726 if (fmt_start[0] !=
'%')
8729 if (fmt_end[0] == 0)
8731 ImStrncpy(buf, fmt_start, ImMin((
int)(fmt_end + 1 - fmt_start), buf_size));
8741 return default_precision;
8743 while (*fmt >=
'0' && *fmt <=
'9')
8750 precision = default_precision;
8752 if (*fmt ==
'e' || *fmt ==
'E')
8754 if ((*fmt ==
'g' || *fmt ==
'G') && precision == INT_MAX)
8756 return (precision == INT_MAX) ? default_precision :
precision;
8759 static float GetMinimumStepAtDecimalPrecision(
int decimal_precision)
8761 static const float min_steps[10] = { 1.0f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f };
8762 if (decimal_precision < 0)
8764 return (decimal_precision >= 0 && decimal_precision < 10) ? min_steps[decimal_precision] : ImPow(10.0
f, (
float)-decimal_precision);
8767 template<
typename TYPE,
typename SIGNEDTYPE>
8768 static inline TYPE RoundScalarWithFormat(
const char* format,
ImGuiDataType data_type, TYPE v)
8771 if (fmt_start[0] !=
'%' || fmt_start[1] ==
'%')
8775 const char* p = v_str;
8779 v = (TYPE)ImAtof(p);
8781 ImAtoi(p, (SIGNEDTYPE*)&v);
8785 template<
typename TYPE,
typename FLOATTYPE>
8786 static inline float SliderBehaviorCalcRatioFromValue(
ImGuiDataType data_type, TYPE v, TYPE v_min, TYPE v_max,
float power,
float linear_zero_pos)
8792 const TYPE v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min);
8795 if (v_clamped < 0.0
f)
8797 const float f = 1.0f - (
float)((v_clamped - v_min) / (ImMin((TYPE)0, v_max) - v_min));
8798 return (1.0f - ImPow(f, 1.0f/power)) * linear_zero_pos;
8802 const float f = (
float)((v_clamped - ImMax((TYPE)0, v_min)) / (v_max - ImMax((TYPE)0, v_min)));
8803 return linear_zero_pos + ImPow(f, 1.0f/power) * (1.0f - linear_zero_pos);
8808 return (
float)((FLOATTYPE)(v_clamped - v_min) / (FLOATTYPE)(v_max - v_min));
8812 template<
typename TYPE,
typename SIGNEDTYPE,
typename FLOATTYPE>
8826 const bool is_power = (power != 1.0f) && is_decimal;
8828 const float grab_padding = 2.0f;
8829 const float slider_sz = is_horizontal ? (bb.
GetWidth() - grab_padding * 2.0f) : (bb.
GetHeight() - grab_padding * 2.0f);
8831 SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max);
8832 if (!is_decimal && v_range >= 0)
8833 grab_sz = ImMax((
float)(slider_sz / (v_range + 1)), style.
GrabMinSize);
8834 grab_sz = ImMin(grab_sz, slider_sz);
8835 const float slider_usable_sz = slider_sz - grab_sz;
8836 const float slider_usable_pos_min = (is_horizontal ? bb.
Min.
x : bb.
Min.
y) + grab_padding + grab_sz*0.5f;
8837 const float slider_usable_pos_max = (is_horizontal ? bb.
Max.
x : bb.
Max.
y) - grab_padding - grab_sz*0.5f;
8840 float linear_zero_pos;
8841 if (is_power && v_min * v_max < 0.0f)
8844 const FLOATTYPE linear_dist_min_to_0 = ImPow(v_min >= 0 ? (FLOATTYPE)v_min : -(FLOATTYPE)v_min, (FLOATTYPE)1.0f/power);
8845 const FLOATTYPE linear_dist_max_to_0 = ImPow(v_max >= 0 ? (FLOATTYPE)v_max : -(FLOATTYPE)v_max, (FLOATTYPE)1.0f/power);
8846 linear_zero_pos = (
float)(linear_dist_min_to_0 / (linear_dist_min_to_0 + linear_dist_max_to_0));
8851 linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f;
8855 bool value_changed =
false;
8858 bool set_new_value =
false;
8859 float clicked_t = 0.0f;
8869 clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f;
8871 clicked_t = 1.0f - clicked_t;
8872 set_new_value =
true;
8878 float delta = is_horizontal ? delta2.
x : -delta2.
y;
8883 else if (delta != 0.0f)
8885 clicked_t = SliderBehaviorCalcRatioFromValue<TYPE,FLOATTYPE>(data_type, *
v, v_min, v_max, power, linear_zero_pos);
8886 if (is_decimal || is_power)
8895 delta = ((delta < 0.0f) ? -1.0f : +1.0f) / (
float)v_range;
8901 set_new_value =
true;
8902 if ((clicked_t >= 1.0f && delta > 0.0f) || (clicked_t <= 0.0f && delta < 0.0f))
8903 set_new_value =
false;
8905 clicked_t = ImSaturate(clicked_t + delta);
8915 if (clicked_t < linear_zero_pos)
8918 float a = 1.0f - (clicked_t / linear_zero_pos);
8919 a = ImPow(a, power);
8920 v_new = ImLerp(ImMin(v_max, (TYPE)0), v_min, a);
8926 if (ImFabs(linear_zero_pos - 1.0f) > 1.e-6f)
8927 a = (clicked_t - linear_zero_pos) / (1.0f - linear_zero_pos);
8930 a = ImPow(a, power);
8931 v_new = ImLerp(ImMax(v_min, (TYPE)0), v_max, a);
8939 v_new = ImLerp(v_min, v_max, clicked_t);
8945 FLOATTYPE v_new_off_f = (v_max - v_min) * clicked_t;
8946 TYPE v_new_off_floor = (TYPE)(v_new_off_f);
8947 TYPE v_new_off_round = (TYPE)(v_new_off_f + (FLOATTYPE)0.5);
8948 if (!is_decimal && v_new_off_floor < v_new_off_round)
8949 v_new = v_min + v_new_off_round;
8951 v_new = v_min + v_new_off_floor;
8956 v_new = RoundScalarWithFormat<TYPE,SIGNEDTYPE>(
format, data_type, v_new);
8962 value_changed =
true;
8968 float grab_t = SliderBehaviorCalcRatioFromValue<TYPE,FLOATTYPE>(data_type, *
v, v_min, v_max, power, linear_zero_pos);
8970 grab_t = 1.0f - grab_t;
8971 const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
8974 grab_bb =
ImRect(grab_pos - grab_sz*0.5f, bb.
Min.
y + grab_padding, grab_pos + grab_sz*0.5f, bb.
Max.
y - grab_padding);
8976 grab_bb =
ImRect(bb.
Min.
x + grab_padding, grab_pos - grab_sz*0.5f, bb.
Max.
x - grab_padding, grab_pos + grab_sz*0.5f);
8979 return value_changed;
8991 return SliderBehaviorT<ImS32, ImS32, float >(bb,
id, data_type, (
ImS32*)v, *(
const ImS32*)v_min, *(
const ImS32*)v_max, format, power, flags);
8994 return SliderBehaviorT<ImU32, ImS32, float >(bb,
id, data_type, (
ImU32*)v, *(
const ImU32*)v_min, *(
const ImU32*)v_max, format, power, flags);
8997 return SliderBehaviorT<ImS64, ImS64, double>(bb,
id, data_type, (
ImS64*)v, *(
const ImS64*)v_min, *(
const ImS64*)v_max, format, power, flags);
9000 return SliderBehaviorT<ImU64, ImS64, double>(bb,
id, data_type, (
ImU64*)v, *(
const ImU64*)v_min, *(
const ImU64*)v_max, format, power, flags);
9002 IM_ASSERT(*(
const float*)v_min >= -FLT_MAX/2.0f && *(
const float*)v_max <= FLT_MAX/2.0f);
9003 return SliderBehaviorT<float, float, float >(bb,
id, data_type, (
float*)v, *(
const float*)v_min, *(
const float*)v_max, format, power, flags);
9005 IM_ASSERT(*(
const double*)v_min >= -DBL_MAX/2.0f && *(
const double*)v_max <= DBL_MAX/2.0f);
9006 return SliderBehaviorT<double,double,double>(bb,
id, data_type, (
double*)v, *(
const double*)v_min, *(
const double*)v_max, format, power, flags);
9016 static const char* PatchFormatStringFloatToInt(
const char* fmt)
9018 if (fmt[0] ==
'%' && fmt[1] ==
'.' && fmt[2] ==
'0' && fmt[3] ==
'f' && fmt[4] == 0)
9022 if (fmt_end > fmt_start && fmt_end[-1] ==
'f')
9024 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
9025 if (fmt_start == fmt && fmt_end[0] == 0)
9031 IM_ASSERT(0 &&
"DragInt(): Invalid format string!");
9053 if (!
ItemAdd(total_bb,
id, &frame_bb))
9063 format = GDataTypeInfo[data_type].
PrintFmt;
9065 format = PatchFormatStringFloatToInt(format);
9068 bool start_text_input =
false;
9079 start_text_input =
true;
9088 const bool value_changed =
SliderBehavior(frame_bb,
id, data_type, v, v_min, v_max, format, power);
9092 const char* value_buf_end = value_buf + DataTypeFormatString(value_buf,
IM_ARRAYSIZE(value_buf), data_type, v, format);
9095 if (label_size.
x > 0.0f)
9098 return value_changed;
9128 format = GDataTypeInfo[data_type].
PrintFmt;
9130 format = PatchFormatStringFloatToInt(format);
9147 const char* value_buf_end = value_buf + DataTypeFormatString(value_buf,
IM_ARRAYSIZE(value_buf), data_type, v, format);
9149 if (label_size.
x > 0.0f)
9152 return value_changed;
9157 float v_deg = (*v_rad) * 360.0f / (2*
IM_PI);
9158 bool value_changed =
SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max,
"%.0f deg", 1.0f);
9159 *v_rad = v_deg * (2*
IM_PI) / 360.0f;
9160 return value_changed;
9186 bool value_changed =
false;
9190 size_t type_size = GDataTypeInfo[data_type].
Size;
9194 value_changed |=
SliderScalar(
"##v", data_type, v, v_min, v_max, format, power);
9198 v = (
void*)((
char*)v + type_size);
9204 return value_changed;
9238 template<
typename TYPE,
typename SIGNEDTYPE,
typename FLOATTYPE>
9239 static bool ImGui::DragBehaviorT(
ImGuiDataType data_type, TYPE* v,
float v_speed,
const TYPE v_min,
const TYPE v_max,
const char* format,
float power)
9244 bool has_min_max = (v_min != v_max) && (v_max - v_max < FLT_MAX);
9245 if (v_speed == 0.0f && has_min_max)
9249 float adjust_delta = 0.0f;
9254 adjust_delta *= 1.0f/100.0f;
9256 adjust_delta *= 10.0f;
9262 v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
9264 adjust_delta *= v_speed;
9269 bool is_already_past_limits_and_pushing_outward = has_min_max && ((*v >= v_max && adjust_delta > 0.0f) || (*v <= v_min && adjust_delta < 0.0f));
9270 if (is_just_activated || is_already_past_limits_and_pushing_outward)
9275 else if (adjust_delta != 0.0f)
9285 FLOATTYPE v_old_ref_for_accum_remainder = (FLOATTYPE)0.0f;
9291 FLOATTYPE v_old_norm_curved = ImPow((FLOATTYPE)(v_cur - v_min) / (FLOATTYPE)(v_max - v_min), (FLOATTYPE)1.0f / power);
9292 FLOATTYPE v_new_norm_curved = v_old_norm_curved + (g.
DragCurrentAccum / (v_max - v_min));
9293 v_cur = v_min + (TYPE)ImPow(ImSaturate((
float)v_new_norm_curved), power) * (v_max - v_min);
9294 v_old_ref_for_accum_remainder = v_old_norm_curved;
9302 v_cur = RoundScalarWithFormat<TYPE, SIGNEDTYPE>(
format, data_type, v_cur);
9308 FLOATTYPE v_cur_norm_curved = ImPow((FLOATTYPE)(v_cur - v_min) / (FLOATTYPE)(v_max - v_min), (FLOATTYPE)1.0f / power);
9317 if (v_cur == (TYPE)-0)
9321 if (*v != v_cur && has_min_max)
9323 if (v_cur < v_min || (v_cur > *v && adjust_delta < 0.0f))
9325 if (v_cur > v_max || (v_cur < *v && adjust_delta > 0.0f))
9351 case ImGuiDataType_S32:
return DragBehaviorT<ImS32, ImS32, float >(data_type, (
ImS32*)v, v_speed, v_min ? *(
const ImS32* )v_min : IM_S32_MIN, v_max ? *(
const ImS32* )v_max : IM_S32_MAX, format, power);
9352 case ImGuiDataType_U32:
return DragBehaviorT<ImU32, ImS32, float >(data_type, (
ImU32*)v, v_speed, v_min ? *(
const ImU32* )v_min : IM_U32_MIN, v_max ? *(
const ImU32* )v_max : IM_U32_MAX, format, power);
9353 case ImGuiDataType_S64:
return DragBehaviorT<ImS64, ImS64, double>(data_type, (
ImS64*)v, v_speed, v_min ? *(
const ImS64* )v_min : IM_S64_MIN, v_max ? *(
const ImS64* )v_max : IM_S64_MAX, format, power);
9354 case ImGuiDataType_U64:
return DragBehaviorT<ImU64, ImS64, double>(data_type, (
ImU64*)v, v_speed, v_min ? *(
const ImU64* )v_min : IM_U64_MIN, v_max ? *(
const ImU64* )v_max : IM_U64_MAX, format, power);
9355 case ImGuiDataType_Float:
return DragBehaviorT<float, float, float >(data_type, (
float*)v, v_speed, v_min ? *(
const float* )v_min : -FLT_MAX, v_max ? *(
const float* )v_max : FLT_MAX, format, power);
9356 case ImGuiDataType_Double:
return DragBehaviorT<double,double,double>(data_type, (
double*)v, v_speed, v_min ? *(
const double*)v_min : -DBL_MAX, v_max ? *(
const double*)v_max : DBL_MAX, format, power);
9370 IM_ASSERT(v_min != NULL && v_max != NULL);
9383 if (!
ItemAdd(total_bb,
id, &frame_bb))
9394 format = GDataTypeInfo[data_type].
PrintFmt;
9396 format = PatchFormatStringFloatToInt(format);
9399 bool start_text_input =
false;
9409 start_text_input =
true;
9418 const bool value_changed =
DragBehavior(
id, data_type, v, v_speed, v_min, v_max, format, power);
9427 const char* value_buf_end = value_buf + DataTypeFormatString(value_buf,
IM_ARRAYSIZE(value_buf), data_type, v, format);
9430 if (label_size.
x > 0.0f)
9433 return value_changed;
9443 bool value_changed =
false;
9447 size_t type_size = GDataTypeInfo[data_type].
Size;
9451 value_changed |=
DragScalar(
"##v", data_type, v, v_speed, v_min, v_max, format, power);
9455 v = (
void*)((
char*)v + type_size);
9461 return value_changed;
9464 bool ImGui::DragFloat(
const char*
label,
float* v,
float v_speed,
float v_min,
float v_max,
const char* format,
float power)
9469 bool ImGui::DragFloat2(
const char*
label,
float v[2],
float v_speed,
float v_min,
float v_max,
const char* format,
float power)
9474 bool ImGui::DragFloat3(
const char*
label,
float v[3],
float v_speed,
float v_min,
float v_max,
const char* format,
float power)
9479 bool ImGui::DragFloat4(
const char*
label,
float v[4],
float v_speed,
float v_min,
float v_max,
const char* format,
float power)
9484 bool ImGui::DragFloatRange2(
const char*
label,
float* v_current_min,
float* v_current_max,
float v_speed,
float v_min,
float v_max,
const char* format,
const char* format_max,
float power)
9495 bool value_changed =
DragFloat(
"##min", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), format, power);
9498 value_changed |=
DragFloat(
"##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, format_max ? format_max : format, power);
9506 return value_changed;
9530 bool ImGui::DragIntRange2(
const char*
label,
int* v_current_min,
int* v_current_max,
float v_speed,
int v_min,
int v_max,
const char* format,
const char* format_max)
9541 bool value_changed =
DragInt(
"##min", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), format);
9544 value_changed |=
DragInt(
"##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, format_max ? format_max : format);
9552 return value_changed;
9555 void ImGui::PlotEx(
ImGuiPlotType plot_type,
const char*
label,
float (*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size)
9565 if (graph_size.
x == 0.0f)
9567 if (graph_size.
y == 0.0f)
9574 if (!
ItemAdd(total_bb, 0, &frame_bb))
9579 if (scale_min == FLT_MAX || scale_max == FLT_MAX)
9581 float v_min = FLT_MAX;
9582 float v_max = -FLT_MAX;
9583 for (
int i = 0; i < values_count; i++)
9585 const float v = values_getter(data, i);
9586 v_min = ImMin(v_min, v);
9587 v_max = ImMax(v_max, v);
9589 if (scale_min == FLT_MAX)
9591 if (scale_max == FLT_MAX)
9597 if (values_count > 0)
9599 int res_w = ImMin((
int)graph_size.
x, values_count) + ((plot_type ==
ImGuiPlotType_Lines) ? -1 : 0);
9606 const float t = ImClamp((g.
IO.
MousePos.
x - inner_bb.
Min.
x) / (inner_bb.
Max.
x - inner_bb.
Min.
x), 0.0f, 0.9999f);
9607 const int v_idx = (
int)(t * item_count);
9608 IM_ASSERT(v_idx >= 0 && v_idx < values_count);
9610 const float v0 = values_getter(data, (v_idx + values_offset) % values_count);
9611 const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count);
9613 SetTooltip(
"%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1);
9619 const float t_step = 1.0f / (
float)res_w;
9620 const float inv_scale = (scale_min == scale_max) ? 0.0f : (1.0f / (scale_max - scale_min));
9622 float v0 = values_getter(data, (0 + values_offset) % values_count);
9624 ImVec2 tp0 =
ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) * inv_scale) );
9625 float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f);
9630 for (
int n = 0;
n < res_w;
n++)
9632 const float t1 = t0 + t_step;
9633 const int v1_idx = (
int)(t0 * item_count + 0.5f);
9634 IM_ASSERT(v1_idx >= 0 && v1_idx < values_count);
9635 const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count);
9636 const ImVec2 tp1 =
ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) * inv_scale) );
9643 window->
DrawList->
AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);
9647 if (pos1.
x >= pos0.
x + 2.0f)
9661 if (label_size.
x > 0.0f)
9673 static float Plot_ArrayGetter(
void* data,
int idx)
9676 const float v = *(
const float*)(
const void*)((
const unsigned char*)plot_data->
Values + (
size_t)idx * plot_data->
Stride);
9680 void ImGui::PlotLines(
const char* label,
const float*
values,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size,
int stride)
9683 PlotEx(
ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (
void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
9686 void ImGui::PlotLines(
const char* label,
float (*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size)
9688 PlotEx(
ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
9694 PlotEx(
ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (
void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
9697 void ImGui::PlotHistogram(
const char* label,
float (*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size)
9719 fraction = ImSaturate(fraction);
9726 char overlay_buf[32];
9730 overlay = overlay_buf;
9734 if (overlay_size.
x > 0.0f)
9735 RenderTextClipped(
ImVec2(ImClamp(fill_br.
x + style.
ItemSpacing.
x, bb.
Min.
x, bb.
Max.
x - overlay_size.
x - style.
ItemInnerSpacing.
x), bb.
Min.
y), bb.
Max, overlay, NULL, &overlay_size,
ImVec2(0.0f,0.5f), &bb);
9752 ImRect total_bb = check_bb;
9753 if (label_size.
x > 0)
9756 if (label_size.
x > 0)
9759 total_bb =
ImRect(ImMin(check_bb.
Min, text_bb.
Min), ImMax(check_bb.
Max, text_bb.
Max));
9775 const float pad = ImMax(1.0f, (
float)(
int)(check_sz / 6.0f));
9780 LogRenderedText(&text_bb.
Min, *v ?
"[x]" :
"[ ]");
9781 if (label_size.
x > 0.0f)
9789 bool v = ((*flags & flags_value) == flags_value);
9790 bool pressed =
Checkbox(label, &v);
9794 *flags |= flags_value;
9796 *flags &= ~flags_value;
9816 ImRect total_bb = check_bb;
9817 if (label_size.
x > 0)
9820 if (label_size.
x > 0)
9823 total_bb.
Add(text_bb);
9830 center.
x = (
float)(
int)center.
x + 0.5f;
9831 center.
y = (
float)(
int)center.
y + 0.5f;
9832 const float radius = check_bb.
GetHeight() * 0.5f;
9842 const float pad = ImMax(1.0f, (
float)(
int)(check_sz / 6.0f));
9853 LogRenderedText(&text_bb.
Min, active ?
"(x)" :
"( )");
9854 if (label_size.
x > 0.0f)
9862 const bool pressed =
RadioButton(label, *v == v_button);
9870 static int InputTextCalcTextLenAndLineCount(
const char* text_begin,
const char** out_text_end)
9873 const char* s = text_begin;
9874 while (
char c = *s++)
9878 if (s[0] !=
'\n' && s[0] !=
'\r')
9887 const float line_height = GImGui->
FontSize;
9888 const float scale = line_height / font->
FontSize;
9891 float line_width = 0.0f;
9893 const ImWchar* s = text_begin;
9894 while (s < text_end)
9896 unsigned int c = (
unsigned int)(*s++);
9899 text_size.
x = ImMax(text_size.
x, line_width);
9900 text_size.
y += line_height;
9902 if (stop_on_new_line)
9909 const float char_width = font->
GetCharAdvance((
unsigned short)c) * scale;
9910 line_width += char_width;
9913 if (text_size.
x < line_width)
9914 text_size.
x = line_width;
9917 *out_offset =
ImVec2(line_width, text_size.
y + line_height);
9919 if (line_width > 0 || text_size.
y == 0.0f)
9920 text_size.
y += line_height;
9932 static int STB_TEXTEDIT_STRINGLEN(
const STB_TEXTEDIT_STRING* obj) {
return obj->CurLenW; }
9935 static int STB_TEXTEDIT_KEYTOTEXT(
int key) {
return key >= 0x10000 ? 0 : key; }
9936 static ImWchar STB_TEXTEDIT_NEWLINE =
'\n';
9939 const ImWchar* text = obj->Text.Data;
9940 const ImWchar* text_remaining = NULL;
9941 const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL,
true);
9947 r->
num_chars = (
int)(text_remaining - (text + line_start_idx));
9950 static bool is_separator(
unsigned int c) {
return ImCharIsBlankW(c) || c==
',' || c==
';' || c==
'(' || c==
')' || c==
'{' || c==
'}' || c==
'[' || c==
']' || c==
'|'; }
9951 static int is_word_boundary_from_right(
STB_TEXTEDIT_STRING* obj,
int idx) {
return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; }
9952 static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(
STB_TEXTEDIT_STRING* obj,
int idx) { idx--;
while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--;
return idx < 0 ? 0 : idx; }
9953 #ifdef __APPLE__ // FIXME: Move setting to IO structure
9954 static int is_word_boundary_from_left(
STB_TEXTEDIT_STRING* obj,
int idx) {
return idx > 0 ? (!is_separator( obj->Text[idx-1] ) && is_separator( obj->Text[idx] ) ) : 1; }
9955 static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(
STB_TEXTEDIT_STRING* obj,
int idx) { idx++;
int len = obj->CurLenW;
while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++;
return idx > len ? len : idx; }
9957 static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(
STB_TEXTEDIT_STRING* obj,
int idx) { idx++;
int len = obj->CurLenW;
while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++;
return idx > len ? len : idx; }
9959 #define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h
9960 #define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL
9971 const ImWchar* src = obj->Text.Data + pos +
n;
9979 const int text_len = obj->CurLenW;
9981 if (new_text_len + text_len + 1 > obj->Text.Size)
9985 if (new_text_len_utf8 + obj->CurLenA + 1 > obj->BufSizeA)
9988 ImWchar* text = obj->Text.Data;
9989 if (pos != text_len)
9990 memmove(text + pos + new_text_len, text + pos, (
size_t)(text_len - pos) *
sizeof(
ImWchar));
9991 memcpy(text + pos, new_text, (
size_t)new_text_len *
sizeof(
ImWchar));
9993 obj->CurLenW += new_text_len;
9994 obj->CurLenA += new_text_len_utf8;
9995 obj->Text[obj->CurLenW] =
'\0';
10001 #define STB_TEXTEDIT_K_LEFT 0x10000 // keyboard input to move cursor left
10002 #define STB_TEXTEDIT_K_RIGHT 0x10001 // keyboard input to move cursor right
10003 #define STB_TEXTEDIT_K_UP 0x10002 // keyboard input to move cursor up
10004 #define STB_TEXTEDIT_K_DOWN 0x10003 // keyboard input to move cursor down
10005 #define STB_TEXTEDIT_K_LINESTART 0x10004 // keyboard input to move cursor to start of line
10006 #define STB_TEXTEDIT_K_LINEEND 0x10005 // keyboard input to move cursor to end of line
10007 #define STB_TEXTEDIT_K_TEXTSTART 0x10006 // keyboard input to move cursor to start of text
10008 #define STB_TEXTEDIT_K_TEXTEND 0x10007 // keyboard input to move cursor to end of text
10009 #define STB_TEXTEDIT_K_DELETE 0x10008 // keyboard input to delete selection or character under cursor
10010 #define STB_TEXTEDIT_K_BACKSPACE 0x10009 // keyboard input to delete selection or character left of cursor
10011 #define STB_TEXTEDIT_K_UNDO 0x1000A // keyboard input to perform undo
10012 #define STB_TEXTEDIT_K_REDO 0x1000B // keyboard input to perform redo
10013 #define STB_TEXTEDIT_K_WORDLEFT 0x1000C // keyboard input to move cursor left one word
10014 #define STB_TEXTEDIT_K_WORDRIGHT 0x1000D // keyboard input to move cursor right one word
10015 #define STB_TEXTEDIT_K_SHIFT 0x20000
10017 #define STB_TEXTEDIT_IMPLEMENTATION
10024 stb_textedit_key(
this, &
StbState, key);
10036 const char* src =
Buf + pos + bytes_count;
10037 while (
char c = *src++)
10052 const int new_text_len = new_text_end ? (
int)(new_text_end - new_text) : (
int)strlen(new_text);
10058 memcpy(
Buf + pos, new_text, (
size_t)new_text_len *
sizeof(
char));
10071 unsigned int c = *p_char;
10073 if (c < 128 && c !=
' ' && !isprint((
int)(c & 0xFF)))
10082 if (c >= 0xE000 && c <= 0xF8FF)
10088 if (!(c >=
'0' && c <=
'9') && (c !=
'.') && (c !=
'-') && (c !=
'+') && (c !=
'*') && (c !=
'/'))
10092 if (!(c >=
'0' && c <=
'9') && (c !=
'.') && (c !=
'-') && (c !=
'+') && (c !=
'*') && (c !=
'/') && (c !=
'e') && (c !=
'E'))
10096 if (!(c >=
'0' && c <=
'9') && !(c >=
'a' && c <= 'f') && !(c >=
'A' && c <=
'F'))
10100 if (c >=
'a' && c <=
'z')
10101 *p_char = (c += (
unsigned int)(
'A'-
'a'));
10104 if (ImCharIsBlankW(c))
10115 callback_data.
UserData = user_data;
10116 if (callback(&callback_data) != 0)
10158 ItemAdd(total_bb,
id, &frame_bb);
10171 if (!
ItemAdd(total_bb,
id, &frame_bb))
10198 const bool focus_requested =
FocusableItemRegister(window,
id, (flags & (ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_AllowTabInput)) == 0);
10200 const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
10202 const bool user_clicked = hovered && io.
MouseClicked[0];
10206 bool clear_active_id =
false;
10209 if (focus_requested || user_clicked || user_scrolled || user_nav_input_start)
10216 const int prev_len_w = edit_state.
CurLenW;
10220 const char* buf_end = NULL;
10227 const bool recycle_state = (edit_state.
Id ==
id) && (prev_len_w == edit_state.
CurLenW);
10236 edit_state.
Id =
id;
10238 stb_textedit_initialize_state(&edit_state.
StbState, !is_multiline);
10239 if (!is_multiline && focus_requested_by_code)
10244 if (!is_multiline && (focus_requested_by_tab || (user_clicked && io.
KeyCtrl)))
10250 if (!is_multiline && !(flags & ImGuiInputTextFlags_CallbackHistory))
10256 clear_active_id =
true;
10259 bool value_changed =
false;
10260 bool enter_pressed =
false;
10268 const char* buf_end = NULL;
10301 stb_textedit_click(&edit_state, &edit_state.
StbState, mouse_x, mouse_y);
10307 stb_textedit_drag(&edit_state, &edit_state.
StbState, mouse_x, mouse_y);
10319 if (!ignore_inputs && is_editable && !user_nav_input_start)
10324 if (InputTextFilterCharacter(&c, flags, callback, user_data))
10333 bool cancel_edit =
false;
10341 const bool is_wordmove_key_down = is_osx ? io.
KeyAlt : io.
KeyCtrl;
10346 const bool is_cut = ((is_shortcut_key && IsKeyPressedMap(
ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(
ImGuiKey_Delete))) && is_editable && !is_password && (!is_multiline || edit_state.
HasSelection());
10347 const bool is_copy = ((is_shortcut_key && IsKeyPressedMap(
ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressedMap(
ImGuiKey_Insert))) && !is_password && (!is_multiline || edit_state.
HasSelection());
10348 const bool is_paste = ((is_shortcut_key && IsKeyPressedMap(
ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(
ImGuiKey_Insert))) && is_editable;
10349 const bool is_undo = ((is_shortcut_key && IsKeyPressedMap(
ImGuiKey_Z)) && is_editable && is_undoable);
10350 const bool is_redo = ((is_shortcut_key && IsKeyPressedMap(
ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(
ImGuiKey_Z))) && is_editable && is_undoable;
10371 if (!is_multiline || (ctrl_enter_for_new_line && !io.
KeyCtrl) || (!ctrl_enter_for_new_line && io.
KeyCtrl))
10373 enter_pressed = clear_active_id =
true;
10375 else if (is_editable)
10377 unsigned int c =
'\n';
10378 if (InputTextFilterCharacter(&c, flags, callback, user_data))
10384 unsigned int c =
'\t';
10385 if (InputTextFilterCharacter(&c, flags, callback, user_data))
10390 clear_active_id = cancel_edit =
true;
10392 else if (is_undo || is_redo)
10397 else if (is_shortcut_key && IsKeyPressedMap(
ImGuiKey_A))
10402 else if (is_cut || is_copy)
10418 stb_textedit_cut(&edit_state, &edit_state.
StbState);
10426 const int clipboard_len = (
int)strlen(clipboard);
10428 int clipboard_filtered_len = 0;
10429 for (
const char* s = clipboard; *s; )
10435 if (c >= 0x10000 || !InputTextFilterCharacter(&c, flags, callback, user_data))
10437 clipboard_filtered[clipboard_filtered_len++] = (
ImWchar)c;
10439 clipboard_filtered[clipboard_filtered_len] = 0;
10440 if (clipboard_filtered_len > 0)
10442 stb_textedit_paste(&edit_state, &edit_state.
StbState, clipboard_filtered, clipboard_filtered_len);
10455 if (is_editable && strncmp(buf, edit_state.
InitialText.
Data, buf_size) != 0)
10458 value_changed =
true;
10465 if (apply_edit_back_to_user_buffer)
10485 if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressedMap(
ImGuiKey_Tab))
10490 else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(
ImGuiKey_UpArrow))
10495 else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(
ImGuiKey_DownArrow))
10509 callback_data.
UserData = user_data;
10510 callback_data.
ReadOnly = !is_editable;
10512 callback_data.
EventKey = event_key;
10525 callback(&callback_data);
10548 value_changed =
true;
10554 if (clear_active_id && g.
ActiveId ==
id)
10567 ImVec2 text_size(0.f, 0.f);
10568 const bool is_currently_scrolling = (edit_state.
Id ==
id && is_multiline && g.
ActiveId == draw_window->
GetIDNoKeepAlive(
"#SCROLLY"));
10569 if (g.
ActiveId ==
id || is_currently_scrolling)
10580 ImVec2 cursor_offset, select_start_offset;
10584 const ImWchar* searches_input_ptr[2];
10585 searches_input_ptr[0] = text_begin + edit_state.
StbState.
cursor;
10586 searches_input_ptr[1] = NULL;
10587 int searches_remaining = 1;
10588 int searches_result_line_number[2] = { -1, -999 };
10592 searches_result_line_number[1] = -1;
10593 searches_remaining++;
10598 searches_remaining += is_multiline ? 1 : 0;
10599 int line_count = 0;
10600 for (
const ImWchar* s = text_begin; *s != 0; s++)
10604 if (searches_result_line_number[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_number[0] = line_count;
if (--searches_remaining <= 0)
break; }
10605 if (searches_result_line_number[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_number[1] = line_count;
if (--searches_remaining <= 0)
break; }
10608 if (searches_result_line_number[0] == -1) searches_result_line_number[0] = line_count;
10609 if (searches_result_line_number[1] == -1) searches_result_line_number[1] = line_count;
10612 cursor_offset.
x = InputTextCalcTextSizeW(
ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).
x;
10613 cursor_offset.
y = searches_result_line_number[0] * g.
FontSize;
10614 if (searches_result_line_number[1] >= 0)
10616 select_start_offset.
x = InputTextCalcTextSizeW(
ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).
x;
10617 select_start_offset.
y = searches_result_line_number[1] * g.
FontSize;
10631 const float scroll_increment_x = size.
x * 0.25f;
10632 if (cursor_offset.
x < edit_state.
ScrollX)
10633 edit_state.
ScrollX = (
float)(
int)ImMax(0.0f, cursor_offset.
x - scroll_increment_x);
10634 else if (cursor_offset.
x - size.
x >= edit_state.
ScrollX)
10635 edit_state.
ScrollX = (
float)(
int)(cursor_offset.
x - size.
x + scroll_increment_x);
10645 float scroll_y = draw_window->
Scroll.
y;
10646 if (cursor_offset.
y - g.
FontSize < scroll_y)
10647 scroll_y = ImMax(0.0f, cursor_offset.
y - g.
FontSize);
10648 else if (cursor_offset.
y - size.
y >= scroll_y)
10649 scroll_y = cursor_offset.
y - size.
y;
10651 draw_window->
Scroll.
y = scroll_y;
10664 float bg_offy_up = is_multiline ? 0.0f : -1.0f;
10665 float bg_offy_dn = is_multiline ? 0.0f : 2.0f;
10667 ImVec2 rect_pos = render_pos + select_start_offset - render_scroll;
10668 for (
const ImWchar* p = text_selected_begin; p < text_selected_end; )
10672 if (rect_pos.
y < clip_rect.
y)
10674 while (p < text_selected_end)
10680 ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL,
true);
10687 rect_pos.
x = render_pos.
x - render_scroll.x;
10696 ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
10697 ImRect cursor_screen_rect(cursor_screen_pos.
x, cursor_screen_pos.
y-g.
FontSize+0.5f, cursor_screen_pos.
x+1.0f, cursor_screen_pos.
y-1.5f);
10698 if (cursor_is_visible && cursor_screen_rect.
Overlaps(clip_rect))
10708 const char* buf_end = NULL;
10710 text_size =
ImVec2(size.
x, InputTextCalcTextLenAndLineCount(buf_display, &buf_end) * g.
FontSize);
10726 LogRenderedText(&render_pos, buf_display, NULL);
10728 if (label_size.
x > 0)
10732 return enter_pressed;
10734 return value_changed;
10740 return InputTextEx(label, buf, (
int)buf_size,
ImVec2(0,0), flags, callback, user_data);
10759 if (format == NULL)
10760 format = GDataTypeInfo[data_type].
PrintFmt;
10763 DataTypeFormatString(buf,
IM_ARRAYSIZE(buf), data_type, data_ptr, format);
10765 bool value_changed =
false;
10766 if ((extra_flags & (ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0)
10785 DataTypeApplyOp(data_type,
'-', data_ptr, data_ptr, g.
IO.
KeyCtrl && step_fast ? step_fast : step);
10786 value_changed =
true;
10791 DataTypeApplyOp(data_type,
'+', data_ptr, data_ptr, g.
IO.
KeyCtrl && step_fast ? step_fast : step);
10792 value_changed =
true;
10806 return value_changed;
10812 return InputScalar(label,
ImGuiDataType_Float, (
void*)v, (
void*)(step>0.0f ? &step : NULL), (
void*)(step_fast>0.0f ? &step_fast : NULL), format, extra_flags);
10818 return InputScalar(label,
ImGuiDataType_Double, (
void*)v, (
void*)(step>0.0 ? &step : NULL), (
void*)(step_fast>0.0 ? &step_fast : NULL), format, extra_flags);
10825 return InputScalar(label,
ImGuiDataType_S32, (
void*)v, (
void*)(step>0 ? &step : NULL), (
void*)(step_fast>0 ? &step_fast : NULL), format, extra_flags);
10835 bool value_changed =
false;
10839 size_t type_size = GDataTypeInfo[data_type].
Size;
10843 value_changed |=
InputScalar(
"##v", data_type, v, step, step_fast, format, extra_flags);
10847 v = (
void*)((
char*)v + type_size);
10854 return value_changed;
10873 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
10876 char format[16] =
"%f";
10877 if (decimal_precision >= 0)
10879 return InputFloat(label, v, step, step_fast, format, extra_flags);
10884 char format[16] =
"%f";
10885 if (decimal_precision >= 0)
10892 char format[16] =
"%f";
10893 if (decimal_precision >= 0)
10900 char format[16] =
"%f";
10901 if (decimal_precision >= 0)
10905 #endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS
10922 static float CalcMaxPopupHeightFromItemCount(
int items_count)
10925 if (items_count <= 0)
10952 if (!
ItemAdd(total_bb,
id, &frame_bb))
10955 bool hovered, held;
10970 if (preview_value != NULL && !(flags & ImGuiComboFlags_NoPreview))
10972 if (label_size.
x > 0)
10986 if (backup_next_window_size_constraint)
10995 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiComboFlags_HeightMask_));
10996 int popup_max_height_in_items = -1;
11008 if (popup_window->WasActive)
11010 ImVec2 size_contents = CalcSizeContents(popup_window);
11011 ImVec2 size_expected = CalcSizeAfterConstraint(popup_window, CalcSizeAutoFit(popup_window, size_contents));
11014 ImRect r_outer = FindAllowedExtentRectForWindow(popup_window);
11023 if (!
Begin(name, NULL, window_flags))
11040 bool ImGui::Combo(
const char* label,
int* current_item,
bool (*items_getter)(
void*,
int,
const char**),
void* data,
int items_count,
int popup_max_height_in_items)
11044 const char* preview_text = NULL;
11045 if (*current_item >= 0 && *current_item < items_count)
11046 items_getter(data, *current_item, &preview_text);
11051 float popup_max_height = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items);
11060 bool value_changed =
false;
11061 for (
int i = 0; i < items_count; i++)
11063 PushID((
void*)(intptr_t)i);
11064 const bool item_selected = (i == *current_item);
11065 const char* item_text;
11066 if (!items_getter(data, i, &item_text))
11067 item_text =
"*Unknown item*";
11070 value_changed =
true;
11079 return value_changed;
11082 static bool Items_ArrayGetter(
void* data,
int idx,
const char** out_text)
11084 const char*
const* items = (
const char*
const*)data;
11086 *out_text = items[idx];
11090 static bool Items_SingleStringGetter(
void* data,
int idx,
const char** out_text)
11093 const char* items_separated_by_zeros = (
const char*)data;
11094 int items_count = 0;
11095 const char* p = items_separated_by_zeros;
11098 if (idx == items_count)
11100 p += strlen(p) + 1;
11111 bool ImGui::Combo(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int height_in_items)
11113 const bool value_changed =
Combo(label, current_item, Items_ArrayGetter, (
void*)items, items_count, height_in_items);
11114 return value_changed;
11118 bool ImGui::Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int height_in_items)
11120 int items_count = 0;
11121 const char* p = items_separated_by_zeros;
11124 p += strlen(p) + 1;
11127 bool value_changed =
Combo(label, current_item, Items_SingleStringGetter, (
void*)items_separated_by_zeros, items_count, height_in_items);
11128 return value_changed;
11147 ImVec2 size(size_arg.
x != 0.0f ? size_arg.
x : label_size.
x, size_arg.
y != 0.0f ? size_arg.
y : label_size.
y);
11150 ImRect bb(pos, pos + size);
11156 float w_draw = ImMax(label_size.
x, window->
Pos.
x + max_x - window_padding.
x - window->
DC.
CursorPos.
x);
11158 ImRect bb_with_spacing(pos, pos + size_draw);
11159 if (size_arg.
x == 0.0f || (flags & ImGuiSelectableFlags_DrawFillAvailWidth))
11160 bb_with_spacing.
Max.
x += window_padding.
x;
11167 bb_with_spacing.
Min.
x -= spacing_L;
11168 bb_with_spacing.
Min.
y -= spacing_U;
11169 bb_with_spacing.
Max.
x += spacing_R;
11170 bb_with_spacing.
Max.
y += spacing_D;
11173 if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->
DC.
ColumnsSet)
11183 bool hovered, held;
11184 bool pressed =
ButtonBehavior(bb_with_spacing,
id, &hovered, &held, button_flags);
11185 if (flags & ImGuiSelectableFlags_Disabled)
11189 if (pressed || hovered)
11197 if (hovered || selected)
11204 if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->
DC.
ColumnsSet)
11212 if (flags & ImGuiSelectableFlags_Disabled)
PopStyleColor();
11222 if (
Selectable(label, *p_selected, flags, size_arg))
11224 *p_selected = !*p_selected;
11250 if (label_size.
x > 0)
11262 if (height_in_items < 0)
11263 height_in_items = ImMin(items_count, 7);
11264 float height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00f);
11289 bool ImGui::ListBox(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int height_items)
11291 const bool value_changed =
ListBox(label, current_item, Items_ArrayGetter, (
void*)items, items_count, height_items);
11292 return value_changed;
11295 bool ImGui::ListBox(
const char* label,
int* current_item,
bool (*items_getter)(
void*,
int,
const char**),
void* data,
int items_count,
int height_in_items)
11301 bool value_changed =
false;
11303 while (clipper.Step())
11304 for (
int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
11306 const bool item_selected = (i == *current_item);
11307 const char* item_text;
11308 if (!items_getter(data, i, &item_text))
11309 item_text =
"*Unknown item*";
11315 value_changed =
true;
11322 return value_changed;
11342 float w = label_size.
x;
11355 if (shortcut_size.
x > 0.0f)
11369 if (
MenuItem(label, shortcut, p_selected ? *p_selected :
false, enabled))
11372 *p_selected = !*p_selected;
11406 FocusFrontMostActiveWindow(g.
NavWindow);
11452 nav_earliest_child = nav_earliest_child->
ParentWindow;
11496 if (menuset_is_open)
11509 float w = label_size.
x;
11527 if (menuset_is_open)
11530 bool want_open =
false, want_close =
false;
11534 bool moving_within_opened_triangle =
false;
11539 ImRect next_window_rect = next_window->Rect();
11541 ImVec2 tb = (window->
Pos.
x < next_window->Pos.x) ? next_window_rect.
GetTL() : next_window_rect.
GetTR();
11542 ImVec2 tc = (window->
Pos.
x < next_window->Pos.x) ? next_window_rect.
GetBL() : next_window_rect.
GetBR();
11543 float extra = ImClamp(ImFabs(ta.
x - tb.
x) * 0.30f, 5.0f, 30.0f);
11544 ta.
x += (window->
Pos.
x < next_window->Pos.x) ? -0.5f : +0.5f;
11545 tb.
y = ta.
y + ImMax((tb.
y - extra) - ta.
y, -100.0f);
11546 tc.
y = ta.
y + ImMin((tc.
y + extra) - ta.
y, +100.0f);
11553 want_open = (!menu_is_open && hovered && !moving_within_opened_triangle) || (!menu_is_open && hovered && pressed);
11557 want_close = menu_is_open;
11558 want_open = !menu_is_open;
11569 if (menu_is_open && pressed && menuset_is_open)
11572 want_open = menu_is_open =
false;
11574 else if (pressed || (hovered && menuset_is_open && !menu_is_open))
11597 menu_is_open |= want_open;
11609 return menu_is_open;
11637 if (text_end > text)
11647 Text(
"#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]);
11649 Text(
"#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]);
11674 for (
float y = p_min.
y + grid_off.
y; y < p_max.
y; y += grid_step, yi++)
11676 float y1 = ImClamp(y, p_min.
y, p_max.
y), y2 = ImMin(y + grid_step, p_max.
y);
11679 for (
float x = p_min.
x + grid_off.
x + (yi & 1) * grid_step; x < p_max.
x; x += grid_step * 2.0f)
11681 float x1 = ImClamp(x, p_min.
x, p_max.
x), x2 = ImMin(x + grid_step, p_max.
x);
11684 int rounding_corners_flags_cell = 0;
11687 rounding_corners_flags_cell &= rounding_corners_flags;
11707 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__InputsMask)));
11708 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__DataTypeMask)));
11709 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__PickerMask)));
11725 if (size.
x == 0.0f)
11726 size.
x = default_size;
11727 if (size.
y == 0.0f)
11728 size.
y = default_size;
11734 bool hovered, held;
11740 ImVec4 col_without_alpha(col.
x, col.
y, col.
z, 1.0f);
11741 float grid_step = ImMin(size.
x, size.
y) / 2.99f;
11744 float off = -0.75f;
11748 float mid_x = (
float)(
int)((bb_inner.
Min.
x + bb_inner.
Max.
x) * 0.5f + 0.5f);
11756 if (col_source.
w < 1.0f)
11770 if (flags & ImGuiColorEditFlags_NoAlpha)
11797 if ((!allow_opt_inputs && !allow_opt_datatype) || !
BeginPopup(
"context"))
11801 if (allow_opt_inputs)
11807 if (allow_opt_datatype)
11814 if (allow_opt_inputs || allow_opt_datatype)
11828 if (flags & ImGuiColorEditFlags_NoAlpha)
11845 if ((!allow_opt_picker && !allow_opt_alpha_bar) || !
ImGui::BeginPopup(
"context"))
11848 if (allow_opt_picker)
11852 for (
int picker_type = 0; picker_type < 2; picker_type++)
11871 if (allow_opt_alpha_bar)
11921 float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };
11926 bool value_changed =
false;
11927 bool value_changed_as_float =
false;
11929 if ((flags & (
ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)
11932 const float w_item_one = ImMax(1.0f, (
float)(
int)((w_items_all - (style.
ItemInnerSpacing.
x) * (components-1)) / (
float)components));
11933 const float w_item_last = ImMax(1.0f, (
float)(
int)(w_items_all - (w_item_one + style.
ItemInnerSpacing.
x) * (components-1)));
11936 const char*
ids[4] = {
"##X",
"##Y",
"##Z",
"##W" };
11937 const char* fmt_table_int[3][4] =
11939 {
"%3d",
"%3d",
"%3d",
"%3d" },
11940 {
"R:%3d",
"G:%3d",
"B:%3d",
"A:%3d" },
11941 {
"H:%3d",
"S:%3d",
"V:%3d",
"A:%3d" }
11943 const char* fmt_table_float[3][4] =
11945 {
"%0.3f",
"%0.3f",
"%0.3f",
"%0.3f" },
11946 {
"R:%0.3f",
"G:%0.3f",
"B:%0.3f",
"A:%0.3f" },
11947 {
"H:%0.3f",
"S:%0.3f",
"V:%0.3f",
"A:%0.3f" }
11956 if (
n + 1 == components)
11958 if (flags & ImGuiColorEditFlags_Float)
11959 value_changed = value_changed_as_float = value_changed |
DragFloat(ids[
n], &f[n], 1.0f/255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);
11961 value_changed |=
DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);
11962 if (!(flags & ImGuiColorEditFlags_NoOptions))
11973 ImFormatString(buf,
IM_ARRAYSIZE(buf),
"#%02X%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255), ImClamp(i[3],0,255));
11975 ImFormatString(buf,
IM_ARRAYSIZE(buf),
"#%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255));
11977 if (
InputText(
"##Text", buf,
IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase))
11979 value_changed =
true;
11981 while (*p ==
'#' || ImCharIsBlankA(*p))
11983 i[0] = i[1] = i[2] = i[3] = 0;
11985 sscanf(p,
"%02X%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2], (
unsigned int*)&i[3]);
11987 sscanf(p,
"%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2]);
11989 if (!(flags & ImGuiColorEditFlags_NoOptions))
11997 if (!(flags & ImGuiColorEditFlags_NoInputs))
12000 const ImVec4 col_v4(col[0], col[1], col[2], alpha ? col[3] : 1.0f);
12011 if (!(flags & ImGuiColorEditFlags_NoOptions))
12017 if (label != label_display_end)
12038 if (picker_active_window == NULL)
12040 if (!value_changed_as_float)
12041 for (
int n = 0;
n < 4;
n++)
12042 f[
n] = i[
n] / 255.0f;
12043 if (flags & ImGuiColorEditFlags_HSV)
12063 memcpy((
float*)col, payload->Data,
sizeof(
float) * 3);
12064 value_changed =
true;
12068 memcpy((
float*)col, payload->Data,
sizeof(
float) * components);
12069 value_changed =
true;
12078 return value_changed;
12083 float col4[4] = { col[0], col[1], col[2], 1.0f };
12086 col[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2];
12131 ColorPickerOptionsPopup(flags, col);
12136 IM_ASSERT(ImIsPowerOfTwo((
int)(flags & ImGuiColorEditFlags__PickerMask)));
12137 if (!(flags & ImGuiColorEditFlags_NoOptions))
12145 float bars_width = square_sz;
12149 float bars_triangles_half_sz = (
float)(
int)(bars_width * 0.20f);
12151 float backup_initial_col[4];
12152 memcpy(backup_initial_col, col, components *
sizeof(
float));
12154 float wheel_thickness = sv_picker_size * 0.08f;
12155 float wheel_r_outer = sv_picker_size * 0.50f;
12156 float wheel_r_inner = wheel_r_outer - wheel_thickness;
12157 ImVec2 wheel_center(picker_pos.
x + (sv_picker_size + bars_width)*0.5f, picker_pos.
y + sv_picker_size*0.5f);
12160 float triangle_r = wheel_r_inner - (
int)(sv_picker_size * 0.027f);
12162 ImVec2 triangle_pb =
ImVec2(triangle_r * -0.5f, triangle_r * -0.866025f);
12163 ImVec2 triangle_pc =
ImVec2(triangle_r * -0.5f, triangle_r * +0.866025f);
12168 bool value_changed =
false, value_changed_h =
false, value_changed_sv =
false;
12179 float initial_dist2 = ImLengthSqr(initial_off);
12180 if (initial_dist2 >= (wheel_r_inner-1)*(wheel_r_inner-1) && initial_dist2 <= (wheel_r_outer+1)*(wheel_r_outer+1))
12183 H = ImAtan2(current_off.
y, current_off.
x) /
IM_PI*0.5f;
12186 value_changed = value_changed_h =
true;
12188 float cos_hue_angle = ImCos(-H * 2.0f *
IM_PI);
12189 float sin_hue_angle = ImSin(-H * 2.0f * IM_PI);
12190 if (
ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)))
12193 ImVec2 current_off_unrotated = ImRotate(current_off, cos_hue_angle, sin_hue_angle);
12195 current_off_unrotated =
ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated);
12198 V = ImClamp(1.0f - vv, 0.0001f, 1.0f);
12199 S = ImClamp(uu / V, 0.0001f, 1.0f);
12200 value_changed = value_changed_sv =
true;
12203 if (!(flags & ImGuiColorEditFlags_NoOptions))
12212 S = ImSaturate((io.
MousePos.
x - picker_pos.
x) / (sv_picker_size-1));
12213 V = 1.0f - ImSaturate((io.
MousePos.
y - picker_pos.
y) / (sv_picker_size-1));
12214 value_changed = value_changed_sv =
true;
12216 if (!(flags & ImGuiColorEditFlags_NoOptions))
12224 H = ImSaturate((io.
MousePos.
y - picker_pos.
y) / (sv_picker_size-1));
12225 value_changed = value_changed_h =
true;
12236 col[3] = 1.0f - ImSaturate((io.
MousePos.
y - picker_pos.
y) / (sv_picker_size-1));
12237 value_changed =
true;
12242 if (!(flags & ImGuiColorEditFlags_NoSidePreview))
12251 if (label != label_display_end)
12253 if ((flags & ImGuiColorEditFlags_NoSidePreview))
12259 if (!(flags & ImGuiColorEditFlags_NoSidePreview))
12262 ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);
12263 if ((flags & ImGuiColorEditFlags_NoLabel))
12266 if (ref_col != NULL)
12269 ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]);
12272 memcpy(col, ref_col, components *
sizeof(
float));
12273 value_changed =
true;
12281 if (value_changed_h || value_changed_sv)
12282 ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10*1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);
12287 PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.
x);
12302 float new_H, new_S, new_V;
12304 if (new_H <= 0 && H > 0)
12306 if (new_V <= 0 && V != new_V)
12308 else if (new_S <= 0)
12317 const ImU32 hue_colors[6+1] = {
IM_COL32(255,0,0,255),
IM_COL32(255,255,0,255),
IM_COL32(0,255,0,255),
IM_COL32(0,255,255,255),
IM_COL32(0,0,255,255),
IM_COL32(255,0,255,255),
IM_COL32(255,0,0,255) };
12320 if (flags & ImGuiColorEditFlags_PickerHueWheel)
12323 const float aeps = 1.5f / wheel_r_outer;
12324 const int segment_per_arc = ImMax(4, (
int)wheel_r_outer / 12);
12325 for (
int n = 0;
n < 6;
n++)
12327 const float a0 = (
n) /6.0f * 2.0f *
IM_PI - aeps;
12328 const float a1 = (
n+1.0f)/6.0f * 2.0f *
IM_PI + aeps;
12330 draw_list->
PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc);
12335 ImVec2 gradient_p0(wheel_center.
x + ImCos(a0) * wheel_r_inner, wheel_center.
y + ImSin(a0) * wheel_r_inner);
12336 ImVec2 gradient_p1(wheel_center.
x + ImCos(a1) * wheel_r_inner, wheel_center.
y + ImSin(a1) * wheel_r_inner);
12341 float cos_hue_angle = ImCos(H * 2.0f *
IM_PI);
12342 float sin_hue_angle = ImSin(H * 2.0f * IM_PI);
12343 ImVec2 hue_cursor_pos(wheel_center.
x + cos_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f, wheel_center.
y + sin_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f);
12344 float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;
12345 int hue_cursor_segments = ImClamp((
int)(hue_cursor_rad / 1.4f), 9, 32);
12346 draw_list->
AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments);
12347 draw_list->
AddCircle(hue_cursor_pos, hue_cursor_rad+1,
IM_COL32(128,128,128,255), hue_cursor_segments);
12351 ImVec2 tra = wheel_center + ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle);
12352 ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle);
12353 ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle);
12356 draw_list->
PrimVtx(tra, uv_white, hue_color32);
12357 draw_list->
PrimVtx(trb, uv_white, hue_color32);
12363 sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V));
12365 else if (flags & ImGuiColorEditFlags_PickerHueBar)
12371 sv_cursor_pos.
x = ImClamp((
float)(
int)(picker_pos.
x + ImSaturate(S) * sv_picker_size + 0.5f), picker_pos.
x + 2, picker_pos.
x + sv_picker_size - 2);
12372 sv_cursor_pos.
y = ImClamp((
float)(
int)(picker_pos.
y + ImSaturate(1 - V) * sv_picker_size + 0.5f), picker_pos.
y + 2, picker_pos.
y + sv_picker_size - 2);
12375 for (
int i = 0; i < 6; ++i)
12376 draw_list->
AddRectFilledMultiColor(
ImVec2(bar0_pos_x, picker_pos.
y + i * (sv_picker_size / 6)),
ImVec2(bar0_pos_x + bars_width, picker_pos.
y + (i + 1) * (sv_picker_size / 6)), hue_colors[i], hue_colors[i], hue_colors[i + 1], hue_colors[i + 1]);
12377 float bar0_line_y = (
float)(
int)(picker_pos.
y + H * sv_picker_size + 0.5f);
12379 RenderArrowsForVerticalBar(draw_list,
ImVec2(bar0_pos_x - 1, bar0_line_y),
ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f);
12383 float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f;
12384 draw_list->
AddCircleFilled(sv_cursor_pos, sv_cursor_rad, col32_no_alpha, 12);
12385 draw_list->
AddCircle(sv_cursor_pos, sv_cursor_rad+1,
IM_COL32(128,128,128,255), 12);
12391 float alpha = ImSaturate(col[3]);
12392 ImRect bar1_bb(bar1_pos_x, picker_pos.
y, bar1_pos_x + bars_width, picker_pos.
y + sv_picker_size);
12395 float bar1_line_y = (
float)(
int)(picker_pos.
y + (1.0f -
alpha) * sv_picker_size + 0.5f);
12397 RenderArrowsForVerticalBar(draw_list,
ImVec2(bar1_pos_x - 1, bar1_line_y),
ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f);
12403 return value_changed && memcmp(backup_initial_col, col, components *
sizeof(
float));
12428 float x1 = window->
Pos.
x;
12429 float x2 = window->
Pos.
x + window->
Size.
x;
12445 LogRenderedText(NULL,
IM_NEWLINE "--------------------------------");
12480 bool item_add =
ItemAdd(bb,
id);
12485 bool hovered, held;
12486 ImRect bb_interact = bb;
12499 float mouse_delta = (axis ==
ImGuiAxis_Y) ? mouse_delta_2d.
y : mouse_delta_2d.
x;
12502 if (mouse_delta < min_size1 - *size1)
12503 mouse_delta = min_size1 - *size1;
12504 if (mouse_delta > *size2 - min_size2)
12505 mouse_delta = *size2 - min_size2;
12508 *size1 += mouse_delta;
12509 *size2 -= mouse_delta;
12585 group_bb.
Max = ImMax(group_bb.
Min, group_bb.
Max);
12587 window->
DC.
CursorPos = group_data.BackupCursorPos;
12591 window->
DC.
IndentX = group_data.BackupIndentX;
12595 if (group_data.AdvanceCursor)
12598 ItemSize(group_bb.
GetSize(), group_data.BackupCurrentLineTextBaseOffset);
12605 if (active_id_within_group)
12628 if (spacing_w < 0.0f) spacing_w = 0.0f;
12704 static float OffsetNormToPixels(
const ImGuiColumnsSet* columns,
float offset_norm)
12706 return offset_norm * (columns->
MaxX - columns->
MinX);
12711 return offset / (columns->
MaxX - columns->
MinX);
12714 static inline float GetColumnsRectHalfWidth() {
return 4.0f; }
12716 static float GetDraggedColumnOffset(
ImGuiColumnsSet* columns,
int column_index)
12739 if (column_index < 0)
12740 column_index = columns->
Current;
12743 const float t = columns->
Columns[column_index].OffsetNorm;
12744 const float x_offset = ImLerp(columns->
MinX, columns->
MaxX, t);
12748 static float GetColumnWidthEx(
ImGuiColumnsSet* columns,
int column_index,
bool before_resize =
false)
12750 if (column_index < 0)
12751 column_index = columns->
Current;
12755 offset_norm = columns->
Columns[column_index + 1].OffsetNormBeforeResize - columns->
Columns[column_index].OffsetNormBeforeResize;
12757 offset_norm = columns->
Columns[column_index + 1].OffsetNorm - columns->
Columns[column_index].OffsetNorm;
12758 return OffsetNormToPixels(columns, offset_norm);
12767 if (column_index < 0)
12768 column_index = columns->
Current;
12769 return OffsetNormToPixels(columns, columns->
Columns[column_index + 1].OffsetNorm - columns->
Columns[column_index].OffsetNorm);
12779 if (column_index < 0)
12780 column_index = columns->
Current;
12784 const float width = preserve_width ? GetColumnWidthEx(columns, column_index, columns->
IsBeingResized) : 0.0f;
12788 columns->
Columns[column_index].OffsetNorm = PixelsToOffsetNorm(columns, offset - columns->
MinX);
12790 if (preserve_width)
12800 if (column_index < 0)
12801 column_index = columns->
Current;
12809 if (column_index < 0)
12810 column_index = columns->
Current;
12837 PushID(0x11223347 + (str_id ? 0 : columns_count));
12838 ImGuiID id = window->
GetID(str_id ? str_id :
"columns");
12845 columns->
Count = columns_count;
12852 columns->
MaxX = ImMax(content_region_width - window->
Scroll.
x, columns->
MinX + 1.0f);
12868 for (
int n = 0;
n < columns_count + 1;
n++)
12876 for (
int n = 0;
n < columns_count;
n++)
12882 column->
ClipRect =
ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX);
12908 bool is_being_resized =
false;
12913 int dragging_column = -1;
12914 for (
int n = 1;
n < columns->
Count;
n++)
12918 const float column_hw = GetColumnsRectHalfWidth();
12924 bool hovered =
false, held =
false;
12928 if (hovered || held)
12931 dragging_column =
n;
12941 if (dragging_column != -1)
12944 for (
int n = 0;
n < columns->
Count + 1;
n++)
12945 columns->
Columns[
n].OffsetNormBeforeResize = columns->
Columns[
n].OffsetNorm;
12947 float x = GetDraggedColumnOffset(columns, dragging_column);
12972 if (columns_count != 1)
12997 PushID(str_id ? str_id :
"#TreePush");
13005 PushID(ptr_id ? ptr_id : (
const void*)
"#TreePush");
13036 Text(
"%s: %s", prefix, (b ?
"true" :
"false"));
13041 Text(
"%s: %d", prefix, v);
13046 Text(
"%s: %d", prefix, v);
13055 Text(fmt, prefix, v);
13059 Text(
"%s: %.3f", prefix, v);
13084 bool source_drag_active =
false;
13086 ImGuiID source_parent_id = 0;
13087 int mouse_button = 0;
13091 if (source_id != 0 && g.
ActiveId != source_id)
13096 if (source_id == 0)
13132 source_id =
ImHash(
"#SourceExtern", 0);
13133 source_drag_active =
true;
13136 if (source_drag_active)
13195 IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
13209 memcpy(payload.
Data, data, data_size);
13211 else if (data_size > 0)
13216 memcpy(payload.
Data, data, data_size);
13220 payload.
Data = NULL;
13288 if (type != NULL && !payload.
IsDataType(type))
13303 payload.
Preview = was_accepted_previously;
13334 #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))
13335 #undef WIN32_LEAN_AND_MEAN
13336 #define WIN32_LEAN_AND_MEAN
13337 #ifndef __MINGW32__
13338 #include <Windows.h>
13340 #include <windows.h>
13345 #if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS)
13348 #pragma comment(lib, "user32")
13351 static const char* GetClipboardTextFn_DefaultImpl(
void*)
13355 if (!OpenClipboard(NULL))
13357 HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT);
13358 if (wbuf_handle == NULL)
13366 buf_local.
resize(buf_len);
13369 GlobalUnlock(wbuf_handle);
13371 return buf_local.
Data;
13374 static void SetClipboardTextFn_DefaultImpl(
void*,
const char* text)
13376 if (!OpenClipboard(NULL))
13379 HGLOBAL wbuf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length *
sizeof(
ImWchar));
13380 if (wbuf_handle == NULL)
13387 GlobalUnlock(wbuf_handle);
13389 SetClipboardData(CF_UNICODETEXT, wbuf_handle);
13396 static const char* GetClipboardTextFn_DefaultImpl(
void*)
13403 static void SetClipboardTextFn_DefaultImpl(
void*,
const char* text)
13407 const char* text_end = text + strlen(text);
13416 #if defined(_WIN32) && !defined(__GNUC__) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)
13420 #pragma comment(lib, "imm32")
13423 static void ImeSetInputScreenPosFn_DefaultImpl(
int x,
int y)
13427 if (HIMC himc = ImmGetContext(hwnd))
13429 COMPOSITIONFORM cf;
13430 cf.ptCurrentPos.x =
x;
13431 cf.ptCurrentPos.y =
y;
13432 cf.dwStyle = CFS_FORCE_POSITION;
13433 ImmSetCompositionWindow(himc, &cf);
13439 static void ImeSetInputScreenPosFn_DefaultImpl(
int,
int) {}
13451 static bool show_draw_cmd_clip_rects =
true;
13455 ImGui::Text(
"%d allocations", (
int)GImAllocatorActiveAllocationsCount);
13456 ImGui::Checkbox(
"Show clipping rectangles when hovering draw commands", &show_draw_cmd_clip_rects);
13478 int elem_offset = 0;
13481 if (pcmd->UserCallback == NULL && pcmd->ElemCount == 0)
13483 if (pcmd->UserCallback)
13485 ImGui::BulletText(
"Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
13489 bool pcmd_node_open =
ImGui::TreeNode((
void*)(pcmd - draw_list->
CmdBuffer.
begin()),
"Draw %4d %s vtx, tex 0x%p, clip_rect (%4.0f,%4.0f)-(%4.0f,%4.0f)", pcmd->ElemCount, draw_list->
IdxBuffer.
Size > 0 ?
"indexed" :
"non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
13492 ImRect clip_rect = pcmd->ClipRect;
13494 for (
int i = elem_offset; i < elem_offset + (
int)pcmd->ElemCount; i++)
13495 vtxs_rect.
Add(draw_list->
VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos);
13499 if (!pcmd_node_open)
13504 while (clipper.
Step())
13509 ImVec2 triangles_pos[3];
13510 for (
int n = 0;
n < 3;
n++, vtx_i++)
13513 triangles_pos[
n] = v.
pos;
13514 buf_p +=
ImFormatString(buf_p, (
int)(buf_end - buf_p),
"%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n", (
n == 0) ?
"vtx" :
" ", vtx_i, v.
pos.
x, v.
pos.
y, v.
uv.
x, v.
uv.
y, v.
col);
13522 overlay_draw_list->
Flags = backup_flags;
13534 for (
int i = 0; i < windows.
Size; i++)
13535 Funcs::NodeWindow(windows[i],
"Window");
13539 static void NodeWindow(
ImGuiWindow* window,
const char* label)
13544 NodeDrawList(window, window->
DrawList,
"DrawList");
13545 ImGui::BulletText(
"Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->
Pos.
x, window->
Pos.
y, window->
Size.
x, window->
Size.
y, window->
SizeContents.
x, window->
SizeContents.
y);
13565 if (
ImGui::TreeNode((
void*)(uintptr_t)columns->
ID,
"Columns Id: 0x%08X, Count: %d, Flags: 0x%04X", columns->
ID, columns->
Count, columns->
Flags))
13568 for (
int column_n = 0; column_n < columns->
Columns.
Size; column_n++)
13569 ImGui::BulletText(
"Column %02d: OffsetNorm %.3f (= %.1f px)", column_n, columns->
Columns[column_n].OffsetNorm, OffsetNormToPixels(columns, columns->
Columns[column_n].OffsetNorm));
13582 Funcs::NodeWindows(g.
Windows,
"Windows");
13624 #ifdef IMGUI_INCLUDE_IMGUI_USER_INL
13625 #include "imgui_user.inl"
IMGUI_API bool BeginDragDropTarget()
IMGUI_API void EndMenuBar()
#define IMGUI_DEBUG_NAV_SCORING
IMGUI_API void SetScrollY(float scroll_y)
IMGUI_API ImVec2 GetItemRectMin()
IMGUI_API ImGuiIO & GetIO()
IMGUI_API void CaptureKeyboardFromApp(bool capture=true)
int ImFormatString(char *buf, size_t buf_size, const char *fmt,...)
IMGUI_API void SetNextWindowBgAlpha(float alpha)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
IMGUI_API bool SliderInt3(const char *label, int v[3], int v_min, int v_max, const char *format="%d")
IMGUI_API void PushButtonRepeat(bool repeat)
IMGUI_API float GetWindowWidth()
#define NAV_MAP_KEY(_KEY, _NAV_INPUT)
int FocusIdxTabRequestNext
IMGUI_API float GetFrameHeightWithSpacing()
int(* ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data)
IMGUI_API bool IsAnyItemHovered()
bool HasSelection() const
void PathStroke(ImU32 col, bool closed, float thickness=1.0f)
IMGUI_API float * GetFloatRef(ImGuiID key, float default_val=0.0f)
ImGuiWindow * RootWindowForTitleBarHighlight
IMGUI_API bool IsMouseClicked(int button, bool repeat=false)
IMGUI_API void RenderText(ImVec2 pos, const char *text, const char *text_end=NULL, bool hide_text_after_hash=true)
ImRect NavInitResultRectRel
IMGUI_API bool DragScalar(const char *label, ImGuiDataType data_type, void *v, float v_speed, const void *v_min=NULL, const void *v_max=NULL, const char *format=NULL, float power=1.0f)
IMGUI_API bool VSliderInt(const char *label, const ImVec2 &size, int *v, int v_min, int v_max, const char *format="%d")
IMGUI_API ImVec2 GetCursorPos()
const char * ImParseFormatTrimDecorations(const char *fmt, char *buf, int buf_size)
IMGUI_API bool SliderInt2(const char *label, int v[2], int v_min, int v_max, const char *format="%d")
#define STB_TEXTEDIT_K_LINESTART
IMGUI_API ImGuiContext * CreateContext(ImFontAtlas *shared_font_atlas=NULL)
IMGUI_API bool IsAnyItemActive()
IMGUI_API void TextUnformatted(const char *text, const char *text_end=NULL)
int ActiveIdAllowNavDirFlags
ImGuiCond SetWindowPosAllowFlags
GLint GLenum GLint components
IMGUI_API bool SliderFloat4(const char *label, float v[4], float v_min, float v_max, const char *format="%.3f", float power=1.0f)
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f)
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
ImVector< ImDrawCmd > CmdBuffer
ImDrawVert * _VtxWritePtr
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API bool IsAnyMouseDown()
bool ActiveIdIsJustActivated
IMGUI_API void AddCircle(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12, float thickness=1.0f)
IMGUI_API bool IsMouseDragging(int button=0, float lock_threshold=-1.0f)
ImRect TitleBarRect() const
int ImTextCharFromUtf8(unsigned int *out_char, const char *in_text, const char *in_text_end)
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in)
IMGUI_API void AddRectFilledMultiColor(const ImVec2 &a, const ImVec2 &b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
IMGUI_API void MarkIniSettingsDirty()
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz)
IMGUI_API bool IsMousePosValid(const ImVec2 *mouse_pos=NULL)
IMGUI_API void SetVoidPtr(ImGuiID key, void *val)
float ModalWindowDarkeningRatio
ImGuiWindow * ParentWindow
IMGUI_API void PushColumnClipRect(int column_index=-1)
if(clusterizer.getNClusters()< minNcl)
GLenum GLuint GLint GLint layer
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2 &size_min, const ImVec2 &size_max, ImGuiSizeCallback custom_callback=NULL, void *custom_callback_data=NULL)
IMGUI_API ImVec2 CalcTextSize(const char *text, const char *text_end=NULL, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
IMGUI_API void PopTextureID()
void(* SetClipboardTextFn)(void *user_data, const char *text)
ImVec2 ActiveIdClickOffset
IMGUI_API void ColorEditOptionsPopup(const float *col, ImGuiColorEditFlags flags)
IMGUI_API void AddInputCharacter(ImWchar c)
IMGUI_API ImVec2 GetCursorScreenPos()
IMGUI_API void PopClipRect()
void OnKeyPressed(int key)
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float &out_r, float &out_g, float &out_b)
IMGUI_API void DeleteChars(int pos, int bytes_count)
void reserve(int capacity)
IMGUI_API void LoadIniSettingsFromMemory(const char *ini_data, size_t ini_size=0)
IMGUI_API bool InputFloat(const char *label, float *v, float step=0.0f, float step_fast=0.0f, const char *format="%.3f", ImGuiInputTextFlags extra_flags=0)
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow *ref_window)
IMGUI_API bool TreeNode(const char *label)
IMGUI_API const char * GetStyleColorName(ImGuiCol idx)
IMGUI_API const char * FindRenderedTextEnd(const char *text, const char *text_end=NULL)
IMGUI_API void LogToTTY(int max_depth=-1)
int WantCaptureMouseNextFrame
IMGUI_API ImGuiWindowSettings * FindWindowSettings(ImGuiID id)
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4 &in)
IMGUI_API bool IsMouseDown(int button)
IMGUI_API ImDrawList * GetOverlayDrawList()
IMGUI_API bool IsWindowChildOf(ImGuiWindow *window, ImGuiWindow *potential_parent)
IMGUI_API void ChannelsSetCurrent(int channel_index)
IMGUI_API void SetTooltipV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API void PopItemFlag()
void PathFillConvex(ImU32 col)
IMGUI_API void appendf(const char *fmt,...) IM_FMTARGS(2)
IMGUI_API bool ListBox(const char *label, int *current_item, const char *const items[], int items_count, int height_in_items=-1)
bool ImTriangleContainsPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
ImGuiLayoutType LayoutType
void * SizeCallbackUserData
IMGUI_API ImGuiContext * GetCurrentContext()
void resize(int new_size)
IMGUI_API void EndMainMenuBar()
int ImTextStrToUtf8(char *buf, int buf_size, const ImWchar *in_text, const ImWchar *in_text_end)
IMGUI_API void SameLine(float pos_x=0.0f, float spacing_w=-1.0f)
unsigned char insert_mode
GLenum GLenum GLsizei len
int ImStrlenW(const ImWchar *str)
IMGUI_API void ListBoxFooter()
float CurveTessellationTol
void(* RenderDrawListsFn)(ImDrawData *data)
IMGUI_API bool Combo(const char *label, int *current_item, const char *const items[], int items_count, int popup_max_height_in_items=-1)
IMGUI_API bool DragFloatRange2(const char *label, float *v_current_min, float *v_current_max, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", const char *format_max=NULL, float power=1.0f)
IMGUI_API void PushMultiItemsWidths(int components, float width_full=0.0f)
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding=0.0f)
bool ActiveIdAllowOverlap
IMGUI_API int GetKeyIndex(ImGuiKey imgui_key)
IMGUI_API bool BeginPopupContextItem(const char *str_id=NULL, int mouse_button=1)
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
ImVec2 ScrollbarClickDeltaToGrabCenter
ImGuiInputTextFlags Flags
IMGUI_API const ImFontGlyph * FindGlyph(ImWchar c) const
IMGUI_API float GetColumnOffset(int column_index=-1)
int FramerateSecPerFrameIdx
IMGUI_API void CaptureMouseFromApp(bool capture=true)
IMGUI_API void ClearFreeMemory()
IMGUI_API void EndCombo()
IMGUI_API bool IsItemFocused()
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type)
IMGUI_API void AddInputCharactersUTF8(const char *utf8_chars)
IMGUI_API ImVec2 GetWindowContentRegionMin()
bool NavHideHighlightOneFrame
#define IM_COL32(R, G, B, A)
IMGUI_API bool DragScalarN(const char *label, ImGuiDataType data_type, void *v, int components, float v_speed, const void *v_min=NULL, const void *v_max=NULL, const char *format=NULL, float power=1.0f)
IMGUI_API void SetHoveredID(ImGuiID id)
const char * ImStrchrRange(const char *str, const char *str_end, char c)
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup()
void *(* ReadOpenFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, const char *name)
ImDrawList OverlayDrawList
int FocusIdxAllRequestCurrent
ImGuiNavMoveResult NavMoveResultLocal
const ImFontGlyph * FallbackGlyph
IMGUI_API void PushTextWrapPos(float wrap_pos_x=0.0f)
IMGUI_API void AddPolyline(const ImVec2 *points, const int num_points, ImU32 col, bool closed, float thickness)
bool BackupActiveIdIsAlive
IMGUI_API void PushID(const char *str_id)
IMGUI_API bool FocusableItemRegister(ImGuiWindow *window, ImGuiID id, bool tab_stop=true)
IMGUI_API bool SetDragDropPayload(const char *type, const void *data, size_t size, ImGuiCond cond=0)
IMGUI_API void SetTooltip(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void EndDragDropTarget()
IMGUI_API bool IsKeyDown(int user_key_index)
ImVector< ImFontGlyph > Glyphs
ImRect DragDropTargetRect
ImGuiWindow * RootWindowForNav
GLint GLint GLsizei GLint border
float TitleBarHeight() const
GLboolean GLboolean GLboolean GLboolean a
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
IMGUI_API void SetWindowSize(const ImVec2 &size, ImGuiCond cond=0)
float KeysDownDurationPrev[512]
IMGUI_API bool InputScalarN(const char *label, ImGuiDataType data_type, void *v, int components, const void *step=NULL, const void *step_fast=NULL, const char *format=NULL, ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2 &size, ImGuiWindowFlags flags=0)
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void SetScrollHere(float center_y_ratio=0.5f)
ImVector< ImDrawIdx > IdxBuffer
float FramerateSecPerFrameAccum
ImVector< ImGuiItemFlags > ItemFlagsStack
int KeyMap[ImGuiKey_COUNT]
ImGuiColumnsSet * ColumnsSet
IMGUI_API void SetFocusID(ImGuiID id, ImGuiWindow *window)
#define IM_F32_TO_INT8_SAT(_VAL)
IMGUI_API ImDrawData * GetDrawData()
IMGUI_API void SetCurrentContext(ImGuiContext *ctx)
IMGUI_API void BuildSortByKey()
IMGUI_API ImGuiID GetID(const char *str_id)
ImGuiSizeCallback SizeCallback
IMGUI_API int GetFrameCount()
IMGUI_API void PushFont(ImFont *font)
IMGUI_API void PopStyleVar(int count=1)
IMGUI_API void PathArcToFast(const ImVec2 ¢re, float radius, int a_min_of_12, int a_max_of_12)
void(* WriteAllFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *out_buf)
IMGUI_API bool BeginMenu(const char *label, bool enabled=true)
IMGUI_API bool Draw(const char *label="Filter (inc,-exc)", float width=0.0f)
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float &out_h, float &out_s, float &out_v)
IMGUI_API bool IsDragDropPayloadBeingAccepted()
IMGUI_API float GetContentRegionAvailWidth()
IMGUI_API void LogToClipboard(int max_depth=-1)
IMGUI_API void ShowMetricsWindow(bool *p_open=NULL)
IMGUI_API void PushTextureID(ImTextureID texture_id)
IMGUI_API float GetTextLineHeightWithSpacing()
#define STB_TEXTEDIT_K_UNDO
ImGuiDragDropFlags DragDropSourceFlags
int BeginOrderWithinContext
GLenum GLenum GLsizei const GLuint GLboolean enabled
bool FontAtlasOwnedByContext
GLuint const GLchar * name
IMGUI_API bool * GetBoolRef(ImGuiID key, bool default_val=false)
IMGUI_API void NextColumn()
IMGUI_API bool DragInt4(const char *label, int v[4], float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d")
#define STB_TEXTEDIT_K_TEXTEND
IMGUI_API bool DragFloat4(const char *label, float v[4], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
IMGUI_API bool IsKeyReleased(int user_key_index)
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
GLfloat GLfloat GLfloat v2
IMGUI_API void PlotHistogram(const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API void AddTriangleFilled(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col)
float BackupCurrentLineTextBaseOffset
IMGUI_API bool DragInt3(const char *label, int v[3], float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d")
ImGuiStorage StateStorage
ImRect NavScoringRectScreen
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor=0.0f, float fast_factor=0.0f)
IMGUI_API void AddRect(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=ImDrawCornerFlags_All, float thickness=1.0f)
IMGUI_API void SetCurrentFont(ImFont *font)
int ImStricmp(const char *str1, const char *str2)
char * ImStrdup(const char *str)
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val)
unsigned char DragDropPayloadBufLocal[8]
IMGUI_API bool IsMouseDoubleClicked(int button)
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags=0)
ImGuiMenuColumns MenuColumns
int ImTextCountUtf8BytesFromStr(const ImWchar *in_text, const ImWchar *in_text_end)
IMGUI_API bool SliderScalar(const char *label, ImGuiDataType data_type, void *v, const void *v_min, const void *v_max, const char *format=NULL, float power=1.0f)
#define STB_TEXTEDIT_K_SHIFT
ImVec2 ImTriangleClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond=0)
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char *label, const char *label_end=NULL)
IMGUI_API bool InputInt(const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags extra_flags=0)
IMGUI_API void AddLine(const ImVec2 &a, const ImVec2 &b, ImU32 col, float thickness=1.0f)
ImVector< ImDrawVert > VtxBuffer
ImGuiInputSource NavInputSource
IMGUI_API float GetFontSize()
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect=false)
IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0)
void * GetVarPtr(ImGuiStyle *style) const
IMGUI_API void SetCursorPosY(float y)
IMGUI_API bool InputScalar(const char *label, ImGuiDataType data_type, void *v, const void *step=NULL, const void *step_fast=NULL, const char *format=NULL, ImGuiInputTextFlags extra_flags=0)
IMGUI_API void ** GetVoidPtrRef(ImGuiID key, void *default_val=NULL)
ImVec4 ClipRectFullscreen
while((z< zmin)||(z > zmax))
ImGuiColorEditFlags ColorEditOptions
IMGUI_API void ClosePopup(ImGuiID id)
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode)
#define STB_TEXTEDIT_K_REDO
ImVector< ImGuiWindow * > CurrentWindowStack
IMGUI_API bool IsItemClicked(int mouse_button=0)
float NavInputs[ImGuiNavInput_COUNT]
IMGUI_API ImDrawList * GetWindowDrawList()
ImVector< unsigned short > IndexLookup
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags=0)
ImVector< ImFont * > FontStack
ImGuiID NavActivatePressedId
IMGUI_API void ActivateItem(ImGuiID id)
IMGUI_API bool DragInt(const char *label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d")
IMGUI_API void SetKeyboardFocusHere(int offset=0)
IMGUI_API ImGuiTextFilter(const char *default_filter="")
#define STB_TEXTEDIT_K_DOWN
IMGUI_API int GetColumnsCount()
ImGuiWindow * RootWindowForTabbing
#define STB_TEXTEDIT_K_LINEEND
#define STB_TEXTEDIT_GETWIDTH_NEWLINE
IMGUI_API void FlattenIntoSingleLayer()
IMGUI_API bool SplitterBehavior(ImGuiID id, const ImRect &bb, ImGuiAxis axis, float *size1, float *size2, float min_size1, float min_size2, float hover_extend=0.0f)
IMGUI_API bool BeginDragDropTargetCustom(const ImRect &bb, ImGuiID id)
IMGUI_API void PopTextWrapPos()
IMGUI_API bool DragFloat(const char *label, float *v, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
ImDrawDataBuilder DrawDataBuilder
GLuint GLfloat GLfloat GLfloat GLfloat y1
bool IsDataType(const char *type) const
IMGUI_API ImGuiID GetHoveredID()
IMGUI_API float GetCursorPosY()
ImGuiWindow(ImGuiContext *context, const char *name)
IMGUI_API void Indent(float indent_w=0.0f)
IMGUI_API bool SliderFloat3(const char *label, float v[3], float v_min, float v_max, const char *format="%.3f", float power=1.0f)
IMGUI_API bool PassFilter(const char *text, const char *text_end=NULL) const
IMGUI_API void Unindent(float indent_w=0.0f)
IMGUI_API bool OpenPopupOnItemClick(const char *str_id=NULL, int mouse_button=1)
ImGuiID GetIDNoKeepAlive(const char *str, const char *str_end=NULL)
IMGUI_API bool ArrowButton(const char *str_id, ImGuiDir dir)
IMGUI_API void DestroyContext(ImGuiContext *ctx=NULL)
ImRect MenuBarRect() const
IMGUI_API bool DragIntRange2(const char *label, int *v_current_min, int *v_current_max, float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d", const char *format_max=NULL)
ImGuiID GetIDFromRectangle(const ImRect &r_abs)
IMGUI_API void PopAllowKeyboardFocus()
IMGUI_API void RenderRectFilledRangeH(ImDrawList *draw_list, const ImRect &rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)
IMGUI_API bool VSliderFloat(const char *label, const ImVec2 &size, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f)
IMGUI_API bool BeginChild(const char *str_id, const ImVec2 &size=ImVec2(0, 0), bool border=false, ImGuiWindowFlags flags=0)
void * ImFileLoadToMemory(const char *filename, const char *file_open_mode, size_t *out_file_size, int padding_bytes)
float CurrentLineTextBaseOffset
IMGUI_API void SetFloat(ImGuiID key, float val)
ImGuiInputTextFlags EventFlag
float DragSpeedDefaultRatio
IMGUI_API void * MemAlloc(size_t size)
IMGUI_API void LabelTextV(const char *label, const char *fmt, va_list args) IM_FMTLIST(2)
IMGUI_API void SetWindowPos(const ImVec2 &pos, ImGuiCond cond=0)
IMGUI_API void RenderArrow(ImVec2 pos, ImGuiDir dir, float scale=1.0f)
#define IM_COL32_BLACK_TRANS
ImGuiWindow * NavLastChildNavWindow
ImVector< ImGuiWindow * > Windows
IMGUI_API bool IsPopupOpen(const char *str_id)
IMGUI_API void SetClipboardText(const char *text)
IMGUI_API bool IsMouseHoveringRect(const ImVec2 &r_min, const ImVec2 &r_max, bool clip=true)
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void *v, float v_speed, const void *v_min, const void *v_max, const char *format, float power)
int WantTextInputNextFrame
ImVector< ImVec4 > _ClipRectStack
bool NavWindowingToggleLayer
IMGUI_API bool SliderAngle(const char *label, float *v_rad, float v_degrees_min=-360.0f, float v_degrees_max=+360.0f)
ImVec2 SizeContentsExplicit
ImGuiNavForward NavMoveRequestForward
ImGuiID GetID(const char *str, const char *str_end=NULL)
ImGuiStb::STB_TexteditState StbState
IMGUI_API void AlignTextToFramePadding()
IMGUI_API void AddTriangle(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col, float thickness=1.0f)
IMGUI_API void MemFree(void *ptr)
const char * ImParseFormatFindStart(const char *fmt)
IMGUI_API void KeepAliveID(ImGuiID id)
IMGUI_API float GetTextLineHeight()
void Expand(const float amount)
ImVector< char > TempTextBuffer
IMGUI_API bool DebugCheckVersionAndDataLayout(const char *version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert)
int ImTextStrFromUtf8(ImWchar *buf, int buf_size, const char *in_text, const char *in_text_end, const char **in_text_remaining)
IMGUI_API bool ColorEdit3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
const char * ImStristr(const char *haystack, const char *haystack_end, const char *needle, const char *needle_end)
IMGUI_API ImGuiStyle & GetStyle()
float MouseDownDurationPrev[5]
IMGUI_API void NewFrameUpdateHoveredWindowAndCaptureFlags()
ImFont InputTextPasswordFont
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
bool NavInitRequestFromMove
const char * ImParseFormatFindEnd(const char *fmt)
void ClipWith(const ImRect &r)
ImVec2 SizeFullAtLastBegin
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio=0.5f)
IMGUI_API void PushItemWidth(float item_width)
IMGUI_API bool ColorEdit4(const char *label, float col[4], ImGuiColorEditFlags flags=0)
ImGuiTextEditState InputTextState
IMGUI_API void ColorTooltip(const char *text, const float *col, ImGuiColorEditFlags flags)
IMGUI_API void SetItemDefaultFocus()
bool CollapseToggleWanted
IMGUI_API void TreePushRawID(ImGuiID id)
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled)
IMGUI_API void SetAllocatorFunctions(void *(*alloc_func)(size_t sz, void *user_data), void(*free_func)(void *ptr, void *user_data), void *user_data=NULL)
IMGUI_API bool Checkbox(const char *label, bool *v)
ImU32 ImHash(const void *data, int data_size, ImU32 seed)
ImVector< ImGuiColMod > ColorModifiers
IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate)
IMGUI_API bool BeginPopupContextWindow(const char *str_id=NULL, int mouse_button=1, bool also_over_items=true)
IMGUI_API void Scrollbar(ImGuiLayoutType direction)
void swap(ImVector< value_type > &rhs)
IMGUI_API float GetWindowHeight()
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags)
IMGUI_API const char * GetVersion()
IMGUI_API float GetCursorPosX()
void push_front(const value_type &v)
#define IM_STATIC_ASSERT(_COND)
#define IMGUI_PAYLOAD_TYPE_COLOR_4F
IMGUI_API void FocusWindow(ImGuiWindow *window)
IMGUI_API bool BeginPopup(const char *str_id, ImGuiWindowFlags flags=0)
ImGuiWindow * ActiveIdWindow
IMGUI_API ImGuiStorage * GetStateStorage()
ImGuiTextBuffer SettingsIniData
ImGuiWindow * NavWindowingTarget
ImVector< ImGuiStyleMod > StyleModifiers
IMGUI_API void RenderNavHighlight(const ImRect &bb, ImGuiID id, ImGuiNavHighlightFlags flags=ImGuiNavHighlightFlags_TypeDefault)
IMGUI_API void AddText(const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL)
bool Contains(const ImVec2 &p) const
IMGUI_API bool RadioButton(const char *label, bool active)
ImGuiDir AutoPosLastDirection
bool DragCurrentAccumDirty
IMGUI_API bool BeginMainMenuBar()
ImRect ContentsRegionRect
ImDrawListSharedData DrawListSharedData
IMGUI_API float CalcItemWidth()
ImGuiID HoveredIdPreviousFrame
IMGUI_API const ImGuiPayload * AcceptDragDropPayload(const char *type, ImGuiDragDropFlags flags=0)
IMGUI_API bool ItemAdd(const ImRect &bb, ImGuiID id, const ImRect *nav_bb=NULL)
float MouseDoubleClickTime
GLuint GLsizei const GLchar * label
IMGUI_API void PopStyleColor(int count=1)
void ImTriangleBarycentricCoords(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p, float &out_u, float &out_v, float &out_w)
ImVector< ImGuiColumnData > Columns
auto dot(const Vertex< T > &a, const Vertex< T > &b) -> decltype(a.x *b.x)
IMGUI_API bool ColorPicker4(const char *label, float col[4], ImGuiColorEditFlags flags=0, const float *ref_col=NULL)
IMGUI_API void BeginTooltip()
IMGUI_API void EndTooltip()
IMGUI_API bool IsAnyItemFocused()
IMGUI_API void Shutdown(ImGuiContext *context)
IMGUI_API ImGuiWindow * GetFrontMostPopupModal()
IMGUI_API ImVec2 GetContentRegionMax()
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow *window)
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert *vert_start, ImDrawVert *vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1)
const char * c_str() const
IMGUI_API ImVec2 GetItemRectMax()
IMGUI_API void SetWindowFocus()
#define IM_F32_TO_INT8_UNBOUND(_VAL)
float NavInputsDownDuration[ImGuiNavInput_COUNT]
IMGUI_API void ChannelsMerge()
ImGuiID ActiveIdPreviousFrame
IMGUI_API void VerticalSeparator()
IMGUI_API ImVec2 GetCursorStartPos()
void ImStrncpy(char *dst, const char *src, size_t count)
IMGUI_API float GetTime()
IMGUI_API bool SliderFloat2(const char *label, float v[2], float v_min, float v_max, const char *format="%.3f", float power=1.0f)
void reserve(int new_capacity)
IMGUI_API void TextColoredV(const ImVec4 &col, const char *fmt, va_list args) IM_FMTLIST(2)
int NavLayerActiveMaskNext
IMGUI_API ImVec2 GetWindowSize()
GLfloat GLfloat GLfloat alpha
IMGUI_API void Initialize(ImGuiContext *context)
IMGUI_API int GetInt(ImGuiID key, int default_val=0) const
IMGUI_API bool SliderInt4(const char *label, int v[4], int v_min, int v_max, const char *format="%d")
IMGUI_API bool CheckboxFlags(const char *label, unsigned int *flags, unsigned int flags_value)
int ImTextCountCharsFromUtf8(const char *in_text, const char *in_text_end)
float CalcFontSize() const
GLenum GLsizei GLsizei GLint * values
IMGUI_API void SetCursorScreenPos(const ImVec2 &screen_pos)
ImVector< ImGuiWindowSettings > SettingsWindows
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv_a=ImVec2(0, 0), const ImVec2 &uv_b=ImVec2(1, 1), ImU32 col=0xFFFFFFFF)
IMGUI_API void EndChildFrame()
IMGUI_API void SetColumnWidth(int column_index, float width)
ImVec2 ScrollTargetCenterRatio
ImGuiWindow * HoveredRootWindow
IMGUI_API ImVec2 GetContentRegionAvail()
IMGUI_API const ImVec4 & GetStyleColorVec4(ImGuiCol idx)
int FocusIdxTabRequestCurrent
#define STB_TEXTEDIT_K_DELETE
IMGUI_API void FocusableItemUnregister(ImGuiWindow *window)
IMGUI_API void ItemSize(const ImVec2 &size, float text_offset_y=0.0f)
IMGUI_API ImGuiMouseCursor GetMouseCursor()
ImGuiWindow * MovingWindow
bool FontAllowUserScaling
IMGUI_API bool SliderScalarN(const char *label, ImGuiDataType data_type, void *v, int components, const void *v_min, const void *v_max, const char *format=NULL, float power=1.0f)
IMGUI_API void NewFrame()
IMGUI_API void AddCircleFilled(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12)
const ImWchar * ImStrbolW(const ImWchar *buf_mid_line, const ImWchar *buf_begin)
float MouseClickedTime[5]
ImWchar InputCharacters[16+1]
IMGUI_API const char * SaveIniSettingsToMemory(size_t *out_ini_size=NULL)
IMGUI_API bool DragFloat2(const char *label, float v[2], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
IMGUI_API void Begin(int items_count, float items_height=-1.0f)
GLboolean GLboolean GLboolean b
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
float GetCharAdvance(ImWchar c) const
ImGuiID ScalarAsInputTextId
ImGuiTextBuffer LogClipboard
#define va_copy(dest, src)
float DragDropAcceptIdCurrRectSurface
IMGUI_API const char * GetClipboardText()
unsigned int _VtxCurrentIdx
IMGUI_API void BeginGroup()
IMGUI_API bool IsItemActive()
int ImFormatStringV(char *buf, size_t buf_size, const char *fmt, va_list args)
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding=0.0f, int rounding_corners_flags=~0)
float PrevLineTextBaseOffset
GLint GLint GLsizei GLint GLenum format
IMGUI_API bool BeginPopupModal(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
ImVector< TextRange > Filters
ImVec2 ImLineClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &p)
ImVec2 MouseClickedPos[5]
IMGUI_API void PopButtonRepeat()
#define STB_TEXTEDIT_K_BACKSPACE
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char *text, const char *text_end, float wrap_width)
IMGUI_API void ClearDragDrop()
IMGUI_API void RenderBullet(ImVec2 pos)
ImVector< ImGuiPopupRef > OpenPopupStack
IMGUI_API void OpenPopup(const char *str_id)
int ImParseFormatPrecision(const char *fmt, int default_precision)
ImGuiItemStatusFlags LastItemStatusFlags
IMGUI_API void CalcListClipping(int items_count, float items_height, int *out_items_display_start, int *out_items_display_end)
IMGUI_API bool IsWindowAppearing()
ImGuiID DragDropAcceptIdPrev
ImGuiCond ContentSizeCond
IMGUI_API ImVec2 GetWindowContentRegionMax()
IMGUI_API bool ButtonEx(const char *label, const ImVec2 &size_arg=ImVec2(0, 0), ImGuiButtonFlags flags=0)
ImVector< char > PrivateClipboard
#define STB_TEXTEDIT_K_WORDLEFT
IMGUI_API float GetScrollMaxY()
IMGUI_API float GetFrameHeight()
ImGuiPlotArrayGetterData(const float *values, int stride)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLint GLint * precision
ImVec2 DisplaySafeAreaPadding
ImGuiCond SetWindowCollapsedAllowFlags
IMGUI_API bool InputDouble(const char *label, double *v, double step=0.0f, double step_fast=0.0f, const char *format="%.6f", ImGuiInputTextFlags extra_flags=0)
ImRect SizeConstraintRect
IMGUI_API void BeginColumns(const char *str_id, int count, ImGuiColumnsFlags flags=0)
IMGUI_API void AddRectFilled(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=ImDrawCornerFlags_All)
IMGUI_API void BulletText(const char *fmt,...) IM_FMTARGS(1)
ImGuiWindow * CurrentWindow
ImVec2 DisplayWindowPadding
float NavWindowingHighlightTimer
IMGUI_API bool InputFloat4(const char *label, float v[4], const char *format="%.3f", ImGuiInputTextFlags extra_flags=0)
IMGUI_API void TextWrappedV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API void SetBool(ImGuiID key, bool val)
int MetricsRenderVertices
IMGUI_API void appendfv(const char *fmt, va_list args) IM_FMTLIST(2)
IMGUI_API bool TreeNodeExV(const char *str_id, ImGuiTreeNodeFlags flags, const char *fmt, va_list args) IM_FMTLIST(3)
void Update(int count, float spacing, bool clear)
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
void(* ImGuiSizeCallback)(ImGuiSizeCallbackData *data)
IMGUI_API int GetColumnIndex()
GLfloat GLfloat GLfloat GLfloat h
int DragDropAcceptFrameCount
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat=true)
IMGUI_API void TreePush(const char *str_id)
IMGUI_API void SetNextWindowFocus()
int ImStrnicmp(const char *str1, const char *str2, size_t count)
iterator insert(const_iterator it, const value_type &v)
int LogAutoExpandMaxDepth
IMGUI_API void TextColored(const ImVec4 &col, const char *fmt,...) IM_FMTARGS(2)
float FramerateSecPerFrame[120]
void(* ImeSetInputScreenPosFn)(int x, int y)
IMGUI_API void LabelText(const char *label, const char *fmt,...) IM_FMTARGS(2)
IMGUI_API bool IsRectVisible(const ImVec2 &size)
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border=true, float rounding=0.0f)
void PrimVtx(const ImVec2 &pos, const ImVec2 &uv, ImU32 col)
IMGUI_API void LoadIniSettingsFromDisk(const char *ini_filename)
IMGUI_API void SetInt(ImGuiID key, int val)
ImDrawCallback UserCallback
float MouseDoubleClickMaxDist
ImVector< float > IndexAdvanceX
IMGUI_API void EndFrame()
ImGuiLayoutType ParentLayoutType
ImGuiBackendFlags BackendFlags
IMGUI_API ImGuiWindow * FindWindowByName(const char *name)
IMGUI_API void PopClipRect()
IMGUI_API bool TreeNodeEx(const char *label, ImGuiTreeNodeFlags flags=0)
IMGUI_API void NavMoveRequestCancel()
IMGUI_API float GetScrollX()
#define STB_TEXTEDIT_K_WORDRIGHT
#define IM_ARRAYSIZE(_ARR)
IMGUI_API void SetWindowFontScale(float scale)
IMGUI_API bool InputInt4(const char *label, int v[4], ImGuiInputTextFlags extra_flags=0)
IMGUI_API void OpenPopupEx(ImGuiID id)
void push_back(const value_type &v)
ImVector< ImGuiWindow * > WindowsSortBuffer
ImVector< ImGuiSettingsHandler > SettingsHandlers
#define STB_TEXTEDIT_K_RIGHT
IMGUI_API void BringWindowToBack(ImGuiWindow *window)
iterator erase(const_iterator it)
IMGUI_API void ScaleAllSizes(float scale_factor)
IMGUI_API void PathArcTo(const ImVec2 ¢re, float radius, float a_min, float a_max, int num_segments=10)
ImGuiNavMoveResult NavMoveResultOther
ImVec2 MouseDragMaxDistanceAbs[5]
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip=true)
IMGUI_API void LogFinish()
IMGUI_API void EndColumns()
int FocusIdxAllRequestNext
IMGUI_API int * GetIntRef(ImGuiID key, int default_val=0)
IMGUI_API void EndDragDropSource()
IMGUI_API bool InvisibleButton(const char *str_id, const ImVec2 &size)
IMGUI_API bool ButtonBehavior(const ImRect &bb, ImGuiID id, bool *out_hovered, bool *out_held, ImGuiButtonFlags flags=0)
#define STB_TEXTEDIT_STRING
IMGUI_API void Separator()
IMGUI_API float GetColumnWidth(int column_index=-1)
ImVector< float > TextWrapPosStack
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiCond cond=0)
IMGUI_API bool SliderBehavior(const ImRect &bb, ImGuiID id, ImGuiDataType data_type, void *v, const void *v_min, const void *v_max, const char *format, float power, ImGuiSliderFlags flags=0)
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate)
ImGuiID NavActivateDownId
IMGUI_API void PushClipRect(const ImVec2 &clip_rect_min, const ImVec2 &clip_rect_max, bool intersect_with_current_clip_rect)
IMGUI_API bool ItemHoverable(const ImRect &bb, ImGuiID id)
IMGUI_API bool MenuItem(const char *label, const char *shortcut=NULL, bool selected=false, bool enabled=true)
ImVector< ImDrawList * > Layers[2]
IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char *label, float(*values_getter)(void *data, int idx), void *data, int values_count, int values_offset, const char *overlay_text, float scale_min, float scale_max, ImVec2 graph_size)
IMGUI_API ImGuiID GetActiveID()
IMGUI_API void EndGroup()
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]
ImGuiConfigFlags ConfigFlags
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow *window)
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2 &pos, float radius)
IMGUI_API bool GetBool(ImGuiID key, bool default_val=false) const
void PathLineTo(const ImVec2 &pos)
IMGUI_API float GetScrollY()
IMGUI_API ImVec2 GetMouseDragDelta(int button=0, float lock_threshold=-1.0f)
IMGUI_API bool InputInt3(const char *label, int v[3], ImGuiInputTextFlags extra_flags=0)
#define STB_TEXTEDIT_K_UP
IMGUI_API void SetCursorPos(const ImVec2 &local_pos)
bool HoveredIdAllowOverlap
int WantCaptureKeyboardNextFrame
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
GLuint GLfloat GLfloat GLfloat x1
bool NavMoveFromClampedRefRect
IMGUI_API void NavInitWindow(ImGuiWindow *window, bool force_reinit)
IMGUI_API bool InputFloat3(const char *label, float v[3], const char *format="%.3f", ImGuiInputTextFlags extra_flags=0)
IMGUI_API float GetFloat(ImGuiID key, float default_val=0.0f) const
IMGUI_API ImVec2 GetMousePos()
IMGUI_API void SaveIniSettingsToDisk(const char *ini_filename)
IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags=0)
IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus)
ImVec2 MenuBarOffsetMinVal
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul=1.0f)
IMGUI_API float CalcWrapWidthForPos(const ImVec2 &pos, float wrap_pos_x)
float MouseDragMaxDistanceSqr[5]
const ImGuiResizeGripDef resize_grip_def[4]
IMGUI_API void ResetMouseDragDelta(int button=0)
ImVector< ImGuiColumnsSet > ColumnsStorage
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
IMGUI_API void * GetVoidPtr(ImGuiID key) const
IMGUI_API void LogButtons()
ImGuiPayload DragDropPayload
ImVec2 DisplayFramebufferScale
IMGUI_API void LogToFile(int max_depth=-1, const char *filename=NULL)
IMGUI_API void BringWindowToFront(ImGuiWindow *window)
float MenuBarHeight() const
#define STB_TEXTEDIT_K_TEXTSTART
const char * begin() const
IMGUI_API void CloseCurrentPopup()
IMGUI_API bool DragInt2(const char *label, int v[2], float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d")
IMGUI_API void BulletTextV(const char *fmt, va_list args) IM_FMTLIST(1)
bool MouseDoubleClicked[5]
GLint GLint GLsizei GLint GLenum GLenum type
ImVector< ImGuiGroupData > GroupStack
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *format="%d")
IMGUI_API bool InputInt2(const char *label, int v[2], ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool InputTextEx(const char *label, char *buf, int buf_size, const ImVec2 &size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
IMGUI_API void SetNextWindowContentSize(const ImVec2 &size)
ImVector< ImGuiID > IDStack
ImGuiMouseCursor MouseCursor
ImGuiCond NextTreeNodeOpenCond
bool SelectedAllMouseLock
GLubyte GLubyte GLubyte GLubyte w
ImGuiNextWindowData NextWindowData
IMGUI_API bool ColorPicker3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
IMGUI_API void RenderTextClipped(const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
ImGuiWindow * GetCurrentWindow()
IMGUI_API void SetAllInt(int val)
float DeclColumns(float w0, float w1, float w2)
IMGUI_API void PlotLines(const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API void Columns(int count=1, const char *id=NULL, bool border=true)
IMGUI_API void EndPopup()
IMGUI_API bool BeginMenuBar()
IMGUI_API bool InputTextMultiline(const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
IMGUI_API void TextWrapped(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API bool VSliderScalar(const char *label, const ImVec2 &size, ImGuiDataType data_type, void *v, const void *v_min, const void *v_max, const char *format=NULL, float power=1.0f)
GLint GLenum GLboolean GLsizei stride
float CurveTessellationTol
ImU32 TreeDepthMayJumpToParentOnPop
IMGUI_API void PushClipRectFullScreen()
IMGUI_API void PopItemWidth()
IMGUI_API void TextDisabled(const char *fmt,...) IM_FMTARGS(1)
void ImStrTrimBlanks(char *buf)
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char *text_begin, const char *text_end=NULL, const char **remaining=NULL) const
IMGUI_API bool TreeNodeV(const char *str_id, const char *fmt, va_list args) IM_FMTLIST(2)
IMGUI_API void TreeAdvanceToLabelPos()
ImGuiCond SizeConstraintCond
IMGUI_API bool GetMouseCursorTexData(ImGuiMouseCursor cursor, ImVec2 *out_offset, ImVec2 *out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2])
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y)
void Translate(const ImVec2 &d)
IMGUI_API ImGuiSettingsHandler * FindSettingsHandler(const char *type_name)
IMGUI_API void SetCursorPosX(float x)
IMGUI_API bool Selectable(const char *label, bool selected=false, ImGuiSelectableFlags flags=0, const ImVec2 &size=ImVec2(0, 0))
ImVector< char > InitialText
FILE * ImFileOpen(const char *filename, const char *mode)
ImFontAtlas * ContainerAtlas
IMGUI_API float GetScrollMaxX()
IMGUI_API bool ListBoxHeader(const char *label, const ImVec2 &size=ImVec2(0, 0))
ImVec2 BackupCursorMaxPos
float KeysDownDuration[512]
IMGUI_API void Dummy(const ImVec2 &size)
IMGUI_API bool ColorButton(const char *desc_id, const ImVec4 &col, ImGuiColorEditFlags flags=0, ImVec2 size=ImVec2(0, 0))
#define IMGUI_PAYLOAD_TYPE_COLOR_3F
IMGUI_API void ClearActiveID()
ImGuiStorage * StateStorage
IMGUI_API void LogText(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API bool IsWindowCollapsed()
IMGUI_API void InsertChars(int pos, const char *text, const char *text_end=NULL)
float MouseDownDuration[5]
IMGUI_API void ProgressBar(float fraction, const ImVec2 &size_arg=ImVec2(-1, 0), const char *overlay=NULL)
IMGUI_API ImVec2 GetItemRectSize()
ImGuiWindow * HoveredWindow
ImGuiID DragDropAcceptIdCurr
IMGUI_API float GetWindowContentRegionWidth()
IMGUI_API float GetTreeNodeToLabelSpacing()
bool Overlaps(const ImRect &r) const
float BackupCurrentLineHeight
IMGUI_API ImDrawListSharedData * GetDrawListSharedData()
IMGUI_API void PrimReserve(int idx_count, int vtx_count)
#define IM_OFFSETOF(_TYPE, _MEMBER)
bool NavDisableMouseHover
IMGUI_API void SetStateStorage(ImGuiStorage *storage)
IMGUI_API void ChannelsSplit(int channels_count)
ImVector< unsigned char > DragDropPayloadBufHeap
IMGUI_API ImFont * GetFont()
IMGUI_API void EndChild()
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
IMGUI_API ImVec2 GetFontTexUvWhitePixel()
IMGUI_API bool InputFloat2(const char *label, float v[2], const char *format="%.3f", ImGuiInputTextFlags extra_flags=0)
IMGUI_API void SetScrollX(float scroll_x)
ImVec2 PlatformImeLastPos
void Add(const ImVec2 &p)
IMGUI_API bool IsClippedEx(const ImRect &bb, ImGuiID id, bool clip_even_when_logged)
IMGUI_API void SetColumnOffset(int column_index, float offset_x)
IMGUI_API ImVec2 GetWindowPos()
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond=0)
IMGUI_API bool IsMouseReleased(int button)
ImRect LastItemDisplayRect
IMGUI_API bool BeginPopupContextVoid(const char *str_id=NULL, int mouse_button=1)
IMGUI_API bool IsItemVisible()
IMGUI_API void SetItemAllowOverlap()
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
IMGUI_API void TextV(const char *fmt, va_list args) IM_FMTLIST(1)
ImGuiWindow * GetCurrentWindowRead()
IMGUI_API void StyleColorsDark(ImGuiStyle *dst=NULL)
ImVector< ImGuiPopupRef > CurrentPopupStack
ImVector< float > ItemWidthStack
#define STB_TEXTEDIT_K_LEFT
IMGUI_API bool BeginCombo(const char *label, const char *preview_value, ImGuiComboFlags flags=0)
const char *(* GetClipboardTextFn)(void *user_data)
ImGuiCond SetWindowSizeAllowFlags
void(* ReadLineFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, void *entry, const char *line)
ImVector< ImGuiWindow * > ChildWindows
IMGUI_API void Value(const char *prefix, bool b)
ImVec4 Colors[ImGuiCol_COUNT]
ImVector< ImFont * > Fonts
char TempBuffer[1024 *3+1]
int BeginOrderWithinParent
ImGuiID NavNextActivateId
ImGuiInputSource ActiveIdSource
IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0)
IMGUI_API void TextDisabledV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API bool SmallButton(const char *label)
float CalcExtraSpace(float avail_w)
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect &bb, ImGuiID id, const char *label, ImGuiDataType data_type, void *data_ptr, const char *format)
IMGUI_API bool DragFloat3(const char *label, float v[3], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
float NavWindowingHighlightAlpha